GuiScreenHorseInventory .java

net.minecraft.client.gui.inventory.GuiScreenHorseInventory (class, 81 lines): members: horseGuiTextures, horseEntity, mousePosY, mousePosx, horseInventory.

net.minecraft.client.gui.inventoryclass81 linesclientextends GuiContainer3.0 KB

API Surface (3)

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

Fields & Constants (6)

horseGuiTextures
playerInventory
horseInventory
horseEntity
mousePosx
mousePosY

String literals (1)

"textures/gui/container/horse.png"

Full Source

GuiScreenHorseInventory.java81 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.gui.inventory;
2
3
import net.minecraft.client.Minecraft;
4
import net.minecraft.client.renderer.GlStateManager;
5
import net.minecraft.entity.passive.EntityHorse;
6
import net.minecraft.inventory.ContainerHorseInventory;
7
import net.minecraft.inventory.IInventory;
8
import net.minecraft.util.ResourceLocation;
9
10
public class GuiScreenHorseInventory extends GuiContainer
11
{
12
    private static final ResourceLocation horseGuiTextures = new ResourceLocation("textures/gui/container/horse.png");
13
14
    /** The player inventory bound to this GUI. */
15
    private IInventory playerInventory;
16
17
    /** The horse inventory bound to this GUI. */
18
    private IInventory horseInventory;
19
20
    /** The EntityHorse whose inventory is currently being accessed. */
21
    private EntityHorse horseEntity;
22
23
    /** The mouse x-position recorded during the last rendered frame. */
24
    private float mousePosx;
25
26
    /** The mouse y-position recorded during the last renderered frame. */
27
    private float mousePosY;
28
29
    public GuiScreenHorseInventory(IInventory playerInv, IInventory horseInv, EntityHorse horse)
30
    {
31
        super(new ContainerHorseInventory(playerInv, horseInv, horse, Minecraft.getMinecraft().thePlayer));
32
        this.playerInventory = playerInv;
33
        this.horseInventory = horseInv;
34
        this.horseEntity = horse;
35
        this.allowUserInput = false;
36
    }
37
38
    /**
39
     * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
40
     */
41
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
42
    {
43
        this.fontRendererObj.drawString(this.horseInventory.getDisplayName().getUnformattedText(), 8, 6, 4210752);
44
        this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
45
    }
46
47
    /**
48
     * Args : renderPartialTicks, mouseX, mouseY
49
     */
50
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
51
    {
52
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
53
        this.mc.getTextureManager().bindTexture(horseGuiTextures);
54
        int i = (this.width - this.xSize) / 2;
55
        int j = (this.height - this.ySize) / 2;
56
        this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
57
58
        if (this.horseEntity.isChested())
59
        {
60
            this.drawTexturedModalRect(i + 79, j + 17, 0, this.ySize, 90, 54);
61
        }
62
63
        if (this.horseEntity.canWearArmor())
64
        {
65
            this.drawTexturedModalRect(i + 7, j + 35, 0, this.ySize + 54, 18, 18);
66
        }
67
68
        GuiInventory.drawEntityOnScreen(i + 51, j + 60, 17, (float)(i + 51) - this.mousePosx, (float)(j + 75 - 50) - this.mousePosY, this.horseEntity);
69
    }
70
71
    /**
72
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
73
     */
74
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
75
    {
76
        this.mousePosx = (float)mouseX;
77
        this.mousePosY = (float)mouseY;
78
        super.drawScreen(mouseX, mouseY, partialTicks);
79
    }
80
}
81

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