summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java
blob: 548991155709b4c2159392e7bc21241bff4cafb5 (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
package darkknight.jewelrycraft.client.gui;

import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import darkknight.jewelrycraft.JewelrycraftMod;
import darkknight.jewelrycraft.api.Curse;
import darkknight.jewelrycraft.events.PlayerRenderHandler;
import darkknight.jewelrycraft.events.ScreenHandler;
import darkknight.jewelrycraft.network.PacketRequestPlayerInfo;
import darkknight.jewelrycraft.network.PacketSendServerPlayersInfo;
import darkknight.jewelrycraft.util.PlayerUtils;
import darkknight.jewelrycraft.util.Variables;

public class GuiCurseInfo extends GuiScreen
{
    World world;
    EntityPlayer player;
    
    public GuiCurseInfo(Container container, World world, EntityPlayer player)
    {
        super();
        this.world = world;
        this.player = player;
    }
    
    public void drawScreen(int x, int y, float size)
    {
        super.drawScreen(x, y, size);
        this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
        int ind = 0;
        if (player != null){
            NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
            if (!playerInfo.hasNoTags()){
                for(Curse curse: Curse.getCurseList())
                    if (playerInfo.getInteger(curse.getName()) > 0){
                        int halfDescrSize = fontRendererObj.getStringWidth(curse.getDescription()) / 2;
                        mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
                        this.drawRect(0, 12 + ind * 34, this.width, 10 + (ind + 1) * 34, 0xff000000);
                        mc.renderEngine.bindTexture(new ResourceLocation(Variables.MODID, "textures/gui/" + curse.getTexturePack() + ".png"));
                        int tag = curse.getTextureID();
                        GL11.glColor3f(1F, 1F, 1F);
                        drawTexturedModalRect(this.width/2 - halfDescrSize - 35, 12 + ind * 34, tag % 8 * 32, tag / 8 * 32, 32, 32);
                        this.drawString(fontRendererObj, curse.getName().substring(curse.getName().indexOf(':') + 1), this.width/2 - halfDescrSize, 20 + ind * 34, 0xffff00);
                        this.drawCenteredString(fontRendererObj, curse.getDescription(), this.width/2, 30 + ind * 34, 0xffffff);
                        ind++;
                    }
            }
        }
    }
}