protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_) {
    if (p_147049_1_.getTabPage() != tabPage) {
      if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory) {
        return false;
      }
    }

    int k = p_147049_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_147049_1_.isTabInFirstRow()) {
      i1 = b0 - 32;
    } else {
      i1 = b0 + this.ySize;
    }

    return p_147049_2_ >= l && p_147049_2_ <= l + 28 && p_147049_3_ >= i1 && p_147049_3_ <= i1 + 32;
  }
  protected void drawGuiContainerBackgroundLayer(
      float p_146976_1_, int p_146976_2_, int p_146976_3_) {
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    RenderHelper.enableGUIStandardItemLighting();
    CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
    CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
    int k = acreativetabs.length;
    int l;

    int start = tabPage * 10;
    k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2));
    if (tabPage != 0) start += 2;

    for (l = start; l < k; ++l) {
      CreativeTabs creativetabs1 = acreativetabs[l];
      this.mc.getTextureManager().bindTexture(field_147061_u);

      if (creativetabs1 == null) continue;
      if (creativetabs1 == creativetabs1.tabInventory) continue;
      if (creativetabs1.getTabIndex() != selectedTabIndex) {
        this.func_147051_a(creativetabs1);
      }
    }

    if (tabPage != 0) {
      if (creativetabs != CreativeTabs.tabAllSearch) {
        this.mc.getTextureManager().bindTexture(field_147061_u);
        func_147051_a(CreativeTabs.tabAllSearch);
      }
      if (creativetabs != CreativeTabs.tabInventory) {
        this.mc.getTextureManager().bindTexture(field_147061_u);
        func_147051_a(CreativeTabs.tabInventory);
      }
    }

    this.mc
        .getTextureManager()
        .bindTexture(
            new ResourceLocation(
                "textures/gui/container/creative_inventory/tab_"
                    + creativetabs.getBackgroundImageName()));

    ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
    int screenwidth = scaledresolution.getScaledWidth();

    this.guiLeft = (int) ((screenwidth - ((this.xSize + this.xSize) / 2)) / 2) + (this.xSize / 2);
    this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
    this.searchField.drawTextBox();

    // Crafting
    ResourceLocation craftingTableGuiTextures =
        new ResourceLocation("textures/gui/container/crafting_table.png");
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
    int b = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(this.guiLeft - 200, b, 0, 0, this.xSize - 20, 80);
    // Crafting

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int i1 = this.guiLeft + 175;
    k = this.guiTop + 18;
    l = k + 112;
    this.mc.getTextureManager().bindTexture(field_147061_u);

    if (creativetabs.shouldHidePlayerInventory()) {
      this.drawTexturedModalRect(
          i1,
          k + (int) ((float) (l - k - 17) * this.currentScroll),
          232 + (this.needsScrollBars() ? 0 : 12),
          0,
          12,
          15);
    }

    if (creativetabs == null || creativetabs.getTabPage() != tabPage) {
      if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory) {
        return;
      }
    }

    this.func_147051_a(creativetabs);

    if (creativetabs == CreativeTabs.tabInventory) {
      GuiInventory.func_147046_a(
          this.guiLeft + 43,
          this.guiTop + 45,
          20,
          (float) (this.guiLeft + 43 - p_146976_2_),
          (float) (this.guiTop + 45 - 30 - p_146976_3_),
          this.mc.thePlayer);
    }
  }