001 package net.minecraft.client.gui.inventory; 002 003 import cpw.mods.fml.relauncher.Side; 004 import cpw.mods.fml.relauncher.SideOnly; 005 import net.minecraft.inventory.ContainerChest; 006 import net.minecraft.inventory.IInventory; 007 import net.minecraft.util.StatCollector; 008 import org.lwjgl.opengl.GL11; 009 010 @SideOnly(Side.CLIENT) 011 public class GuiChest extends GuiContainer 012 { 013 private IInventory upperChestInventory; 014 private IInventory lowerChestInventory; 015 016 /** 017 * window height is calculated with this values, the more rows, the heigher 018 */ 019 private int inventoryRows = 0; 020 021 public GuiChest(IInventory par1IInventory, IInventory par2IInventory) 022 { 023 super(new ContainerChest(par1IInventory, par2IInventory)); 024 this.upperChestInventory = par1IInventory; 025 this.lowerChestInventory = par2IInventory; 026 this.allowUserInput = false; 027 short var3 = 222; 028 int var4 = var3 - 108; 029 this.inventoryRows = par2IInventory.getSizeInventory() / 9; 030 this.ySize = var4 + this.inventoryRows * 18; 031 } 032 033 /** 034 * Draw the foreground layer for the GuiContainer (everything in front of the items) 035 */ 036 protected void drawGuiContainerForegroundLayer(int par1, int par2) 037 { 038 this.fontRenderer.drawString(StatCollector.translateToLocal(this.lowerChestInventory.getInvName()), 8, 6, 4210752); 039 this.fontRenderer.drawString(StatCollector.translateToLocal(this.upperChestInventory.getInvName()), 8, this.ySize - 96 + 2, 4210752); 040 } 041 042 /** 043 * Draw the background layer for the GuiContainer (everything behind the items) 044 */ 045 protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) 046 { 047 int var4 = this.mc.renderEngine.getTexture("/gui/container.png"); 048 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); 049 this.mc.renderEngine.bindTexture(var4); 050 int var5 = (this.width - this.xSize) / 2; 051 int var6 = (this.height - this.ySize) / 2; 052 this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.inventoryRows * 18 + 17); 053 this.drawTexturedModalRect(var5, var6 + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); 054 } 055 }