| 1 | package net.minecraft.client.gui.inventory;
|
| 2 |
|
| 3 | import net.minecraft.client.renderer.GlStateManager;
|
| 4 | import net.minecraft.entity.player.InventoryPlayer;
|
| 5 | import net.minecraft.inventory.ContainerDispenser;
|
| 6 | import net.minecraft.inventory.IInventory;
|
| 7 | import net.minecraft.util.ResourceLocation;
|
| 8 |
|
| 9 | public class GuiDispenser extends GuiContainer
|
| 10 | {
|
| 11 | private static final ResourceLocation dispenserGuiTextures = new ResourceLocation("textures/gui/container/dispenser.png");
|
| 12 |
|
| 13 | /** The player inventory bound to this GUI. */
|
| 14 | private final InventoryPlayer playerInventory;
|
| 15 |
|
| 16 | /** The inventory contained within the corresponding Dispenser. */
|
| 17 | public IInventory dispenserInventory;
|
| 18 |
|
| 19 | public GuiDispenser(InventoryPlayer playerInv, IInventory dispenserInv)
|
| 20 | {
|
| 21 | super(new ContainerDispenser(playerInv, dispenserInv));
|
| 22 | this.playerInventory = playerInv;
|
| 23 | this.dispenserInventory = dispenserInv;
|
| 24 | }
|
| 25 |
|
| 26 | /**
|
| 27 | * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
|
| 28 | */
|
| 29 | protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
| 30 | {
|
| 31 | String s = this.dispenserInventory.getDisplayName().getUnformattedText();
|
| 32 | this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
| 33 | this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
|
| 34 | }
|
| 35 |
|
| 36 | /**
|
| 37 | * Args : renderPartialTicks, mouseX, mouseY
|
| 38 | */
|
| 39 | protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
|
| 40 | {
|
| 41 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
| 42 | this.mc.getTextureManager().bindTexture(dispenserGuiTextures);
|
| 43 | int i = (this.width - this.xSize) / 2;
|
| 44 | int j = (this.height - this.ySize) / 2;
|
| 45 | this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
|
| 46 | }
|
| 47 | }
|
| 48 |
|