summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java
blob: 3ca0a20eb3fc980639aeba35c7ca80cd9988fed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package darkknight.jewelrycraft.client.gui;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import darkknight.jewelrycraft.client.TabJewelry;
import darkknight.jewelrycraft.client.TabRegistry;
import darkknight.jewelrycraft.client.gui.container.ContainerJewelryTab;
import darkknight.jewelrycraft.events.KeyBindings;

public class GuiJewelry extends GuiContainer
{
    ResourceLocation texture;
    
    /**
     * @param containerJewelryTab
     * @param texture
     */
    public GuiJewelry(ContainerJewelryTab containerJewelryTab, ResourceLocation texture)
    {
        super(containerJewelryTab);
        xSize = 194;
        ySize = 166;
        this.texture = texture;
    }
    
    /**
     * @param f
     * @param mouseX
     * @param mouseY
     */
    @Override
    public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY)
    {
        GL11.glColor3f(1, 1, 1);
        Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
        drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
        GL11.glPushMatrix();
        GuiInventory.func_147046_a(guiLeft - 24, guiTop + 124, 60, (float)(guiLeft - 24) - mouseX, (float)(guiTop + 124 - 90) - mouseY, this.mc.thePlayer);
        GL11.glPopMatrix();
    }
    
    /**
     * @param mouseX
     * @param mouseY
     */
    @Override
    public void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
    {}
    
    /**
     * @param charecter
     * @param key
     */
    @Override
    protected void keyTyped(char charecter, int key)
    {
        super.keyTyped(charecter, key);
        if (key == KeyBindings.inventory.getKeyCode()) mc.thePlayer.closeScreen();
    }

    @Override
    public void initGui ()
    {
        super.initGui();
        int cornerX = guiLeft;
        int cornerY = guiTop;
        this.buttonList.clear();
        TabRegistry.updateTabValues(cornerX, cornerY, TabJewelry.class);
        TabRegistry.addTabsToList(this.buttonList);
    }
}