GuiHopper .java

net.minecraft.client.gui.GuiHopper (class, 52 lines): members: HOPPER_GUI_TEXTURE, hopperInventory, playerInventory, drawGuiContainerBackgroundLayer.

net.minecraft.client.guiclass52 linesclientextends GuiContainer2.0 KB

API Surface (2)

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

Fields & Constants (3)

HOPPER_GUI_TEXTURE
playerInventory
hopperInventory

String literals (1)

"textures/gui/container/hopper.png"

Full Source

GuiHopper.java52 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.client.gui.inventory.GuiContainer;
5
import net.minecraft.client.renderer.GlStateManager;
6
import net.minecraft.entity.player.InventoryPlayer;
7
import net.minecraft.inventory.ContainerHopper;
8
import net.minecraft.inventory.IInventory;
9
import net.minecraft.util.ResourceLocation;
10
11
public class GuiHopper extends GuiContainer
12
{
13
    /** The ResourceLocation containing the gui texture for the hopper */
14
    private static final ResourceLocation HOPPER_GUI_TEXTURE = new ResourceLocation("textures/gui/container/hopper.png");
15
16
    /** The player inventory currently bound to this GUI instance */
17
    private IInventory playerInventory;
18
19
    /** The hopper inventory bound to this GUI instance */
20
    private IInventory hopperInventory;
21
22
    public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv)
23
    {
24
        super(new ContainerHopper(playerInv, hopperInv, Minecraft.getMinecraft().thePlayer));
25
        this.playerInventory = playerInv;
26
        this.hopperInventory = hopperInv;
27
        this.allowUserInput = false;
28
        this.ySize = 133;
29
    }
30
31
    /**
32
     * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
33
     */
34
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
35
    {
36
        this.fontRendererObj.drawString(this.hopperInventory.getDisplayName().getUnformattedText(), 8, 6, 4210752);
37
        this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
38
    }
39
40
    /**
41
     * Args : renderPartialTicks, mouseX, mouseY
42
     */
43
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
44
    {
45
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
46
        this.mc.getTextureManager().bindTexture(HOPPER_GUI_TEXTURE);
47
        int i = (this.width - this.xSize) / 2;
48
        int j = (this.height - this.ySize) / 2;
49
        this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
50
    }
51
}
52

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