protected void func_147051_a(CreativeTabs p_147051_1_) { boolean flag = p_147051_1_.getTabIndex() == selectedTabIndex; boolean flag1 = p_147051_1_.isTabInFirstRow(); int i = p_147051_1_.getTabColumn(); int j = i * 28; int k = 0; int l = this.guiLeft + 28 * i; int i1 = this.guiTop; byte b0 = 32; if (flag) { k += 32; } if (i == 5) { l = this.guiLeft + this.xSize - 28; } else if (i > 0) { l += i; } if (flag1) { i1 -= 28; } else { k += 64; i1 += this.ySize - 4; } GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor3f(1F, 1F, 1F); // Forge: Reset color in case Items change it. GL11.glEnable( GL11.GL_BLEND); // Forge: Make sure blend is enabled else tabs show a white border. this.drawTexturedModalRect(l, i1, j, k, 28, b0); this.zLevel = 100.0F; itemRender.zLevel = 100.0F; l += 6; i1 += 8 + (flag1 ? 1 : -1); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); ItemStack itemstack = p_147051_1_.getIconItemStack(); itemRender.renderItemAndEffectIntoGUI( this.fontRendererObj, this.mc.getTextureManager(), itemstack, l, i1); itemRender.renderItemOverlayIntoGUI( this.fontRendererObj, this.mc.getTextureManager(), itemstack, l, i1); GL11.glDisable(GL11.GL_LIGHTING); itemRender.zLevel = 0.0F; this.zLevel = 0.0F; }
private static boolean isVanillaTab(CreativeTabs t) { return t.getTabIndex() <= 11; }
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); } }
private void setCurrentCreativeTab(CreativeTabs p_147050_1_) { if (p_147050_1_ == null) return; int i = selectedTabIndex; selectedTabIndex = p_147050_1_.getTabIndex(); CreativeInv.ContainerCreative containercreative = (CreativeInv.ContainerCreative) this.inventorySlots; this.field_147008_s.clear(); containercreative.itemList.clear(); p_147050_1_.displayAllReleventItems(containercreative.itemList); if (p_147050_1_ == CreativeTabs.tabInventory) { Container container = this.mc.thePlayer.inventoryContainer; if (this.field_147063_B == null) { this.field_147063_B = containercreative.inventorySlots; } containercreative.inventorySlots = new ArrayList(); for (int j = 0; j < container.inventorySlots.size(); ++j) { CreativeInv.CreativeSlot creativeslot = new CreativeInv.CreativeSlot((Slot) container.inventorySlots.get(j), j); containercreative.inventorySlots.add(creativeslot); int k; int l; int i1; if (j >= 5 && j < 9) { k = j - 5; l = k / 2; i1 = k % 2; creativeslot.xDisplayPosition = 9 + l * 54; creativeslot.yDisplayPosition = 6 + i1 * 27; } else if (j >= 0 && j < 5) { creativeslot.yDisplayPosition = -2000; creativeslot.xDisplayPosition = -2000; } else if (j < container.inventorySlots.size()) { k = j - 9; l = k % 9; i1 = k / 9; creativeslot.xDisplayPosition = 9 + l * 18; if (j >= 36) { creativeslot.yDisplayPosition = 112; } else { creativeslot.yDisplayPosition = 54 + i1 * 18; } } } this.field_147064_C = new Slot(field_147060_v, 0, 173, 112); containercreative.inventorySlots.add(this.field_147064_C); } else if (i == CreativeTabs.tabInventory.getTabIndex()) { containercreative.inventorySlots = this.field_147063_B; this.field_147063_B = null; } if (this.searchField != null) { if (p_147050_1_.hasSearchBar()) { this.searchField.setVisible(true); this.searchField.setCanLoseFocus(false); this.searchField.setFocused(true); this.searchField.setText(""); this.updateCreativeSearch(); } else { this.searchField.setVisible(false); this.searchField.setCanLoseFocus(true); this.searchField.setFocused(false); } } this.currentScroll = 0.0F; containercreative.scrollTo(0.0F); }