예제 #1
0
  /**
   * Renders the creative inventory hovering text if mouse is over it. Returns true if did render or
   * false otherwise. Params: current creative tab to be checked, current mouse x position, current
   * mouse y position.
   */
  protected boolean renderCreativeInventoryHoveringText(
      CreativeTabs p_147052_1_, int p_147052_2_, int p_147052_3_) {
    int k = p_147052_1_.getTabColumn();
    int l = 28 * k;
    byte b0 = 0;

    if (k == 5) {
      l = this.xSize - 28 + 2;
    } else if (k > 0) {
      l += k;
    }

    int i1;

    if (p_147052_1_.isTabInFirstRow()) {
      i1 = b0 - 32;
    } else {
      i1 = b0 + this.ySize;
    }

    if (this.func_146978_c(l + 3, i1 + 3, 23, 27, p_147052_2_, p_147052_3_)) {
      this.drawCreativeTabHoveringText(
          I18n.format(p_147052_1_.getTranslatedTabLabel(), new Object[0]),
          p_147052_2_,
          p_147052_3_);
      return true;
    } else {
      return false;
    }
  }
예제 #2
0
  /** Draw the foreground layer for the GuiContainer (everything in front of the items) */
  protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
    CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];

    if (creativetabs != null && creativetabs.drawInForegroundOfTab()) {
      GL11.glDisable(GL11.GL_BLEND);
      this.fontRendererObj.drawString(
          I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
    }
  }
예제 #3
0
  protected void renderToolTip(ItemStack p_146285_1_, int p_146285_2_, int p_146285_3_) {
    if (selectedTabIndex == CreativeTabs.tabAllSearch.getTabIndex()) {
      List list =
          p_146285_1_.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
      CreativeTabs creativetabs = p_146285_1_.getItem().getCreativeTab();

      if (creativetabs == null && p_146285_1_.getItem() == Items.enchanted_book) {
        Map map = EnchantmentHelper.getEnchantments(p_146285_1_);

        if (map.size() == 1) {
          Enchantment enchantment =
              Enchantment.enchantmentsList[((Integer) map.keySet().iterator().next()).intValue()];
          CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
          int k = acreativetabs.length;

          for (int l = 0; l < k; ++l) {
            CreativeTabs creativetabs1 = acreativetabs[l];

            if (creativetabs1.func_111226_a(enchantment.type)) {
              creativetabs = creativetabs1;
              break;
            }
          }
        }
      }

      if (creativetabs != null) {
        list.add(
            1,
            ""
                + EnumChatFormatting.BOLD
                + EnumChatFormatting.BLUE
                + I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]));
      }

      for (int i1 = 0; i1 < list.size(); ++i1) {
        if (i1 == 0) {
          list.set(i1, p_146285_1_.getRarity().rarityColor + (String) list.get(i1));
        } else {
          list.set(i1, EnumChatFormatting.GRAY + (String) list.get(i1));
        }
      }

      this.func_146283_a(list, p_146285_2_, p_146285_3_);
    } else {
      super.renderToolTip(p_146285_1_, p_146285_2_, p_146285_3_);
    }
  }