GuiDispenser .java

net.minecraft.client.gui.inventory.GuiDispenser (class, 48 lines): members: dispenserGuiTextures, dispenserInventory, playerInventory. imports: IInventory.

net.minecraft.client.gui.inventoryclass48 linesclientextends GuiContainer1.9 KB

API Surface (2)

void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)

Fields & Constants (3)

dispenserGuiTextures
playerInventory
dispenserInventory

String literals (1)

"textures/gui/container/dispenser.png"

Full Source

GuiDispenser.java48 lines · MCP 1.8.9 · verbatimOriginal ↗
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

Deobfuscated MCP 1.8.9 source of GuiDispenser from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/gui/inventory/GuiDispenser.java), stored verbatim.