package com.bernard.torch.gui; import com.bernard.torch.blocks.tileentities.TorchRechargerTileEntity; import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; public class TorchRechargerGuiContainer extends GuiContainer { private static final ResourceLocation background = new ResourceLocation("torch_mod", "textures/guis/torch_recharger.png"); public TorchRechargerTileEntity tile; public IInventory playerInventory; private float mouseX = 0.0F; private float mouseY = 0.0F; public TorchRechargerGuiContainer(TorchRechargerTileEntity te, InventoryPlayer inventory) { super(new TorchRechargerContainer(te, inventory)); this.tile = te; this.playerInventory = inventory; this.allowUserInput = false; this.xSize = 176; this.ySize = 166; } public boolean doesGuiPauseGame() { return false; } public void drawScreen(int x, int y, float par3) { this.mouseX = x; this.mouseY = y; super.drawScreen(x, y, par3); } protected void drawGuiContainerForegroundLayer(int x, int y) { int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; if ((this.mouseX >= k + 101) && (this.mouseX < k + 116) && (this.mouseY >= l + 8) && (this.mouseY < l + 81)) { List li = new ArrayList(); li.add("Torches stock�s :"); li.add(Integer.toString(this.tile.getTorchValue(), 10)); drawHoveringText(li, (int)this.mouseX - k, (int)this.mouseY - l, this.fontRendererObj); } else if ((this.mouseX >= k + 45) && (this.mouseX < k + 70) && (this.mouseY >= l + 9) && (this.mouseY < l + 38)) { List li = new ArrayList(); li.add("Charbon stock� :"); li.add(Integer.toString(this.tile.getCoalValue(), 10)); drawHoveringText(li, (int)this.mouseX - k, (int)this.mouseY - l, this.fontRendererObj); } else if ((this.mouseX >= k + 56) && (this.mouseX < k + 60) && (this.mouseY >= l + 40) && (this.mouseY < l + 67)) { List li = new ArrayList(); li.add("Batons stock�s :"); li.add(Integer.toString(this.tile.getStickValue(), 10)); drawHoveringText(li, (int)this.mouseX - k, (int)this.mouseY - l, this.fontRendererObj); } } protected void drawGuiContainerBackgroundLayer(float partialRenderTick, int x, int y) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(background); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int meta = this.tile.blockMetadata; if (meta < 0) meta = 0; int torchPixels = Math.floorDiv(this.tile.getTorchValue() * 80, this.tile.getMaxTorchValue()); drawTexturedModalRect(k + 94, l + 1 + 80 - torchPixels, this.xSize, 80 - torchPixels, 29, torchPixels); int coalPixels = Math.floorDiv(this.tile.getCoalValue() * 32, this.tile.getMaxCoalValue()); drawTexturedModalRect(k + 42, l + 7 + 32 - coalPixels, this.xSize, 112 - coalPixels, 30, coalPixels); int stickPixels = Math.floorDiv(this.tile.getStickValue() * 40, this.tile.getMaxStickValue()); drawTexturedModalRect(k + 53, l + 39 + 40 - stickPixels, this.xSize, 152 - stickPixels, 9, stickPixels); } }