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