summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/client
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-07-01 16:11:31 +0100
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-07-01 16:11:31 +0100
commit46186569d5cb462f90e59a37dc17a9fad51cfa4a (patch)
tree7d0915f21cb4b9d10bb37ae7b6054dfd0f9b1ac5 /src/main/java/darkknight/jewelrycraft/client
parentb65c980fffb286feb2853245411f5bafb73daf15 (diff)
Added a curse tab, added a config to enable/disable extra jewelry info,
plus more!
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/client')
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/TabCurses.java27
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/TabRegistry.java170
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java189
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java185
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java148
5 files changed, 411 insertions, 308 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/client/TabCurses.java b/src/main/java/darkknight/jewelrycraft/client/TabCurses.java
new file mode 100644
index 0000000..e9878b0
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/TabCurses.java
@@ -0,0 +1,27 @@
+package darkknight.jewelrycraft.client;
+
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.item.ItemList;
+import darkknight.jewelrycraft.network.PacketKeyPressEvent;
+
+public class TabCurses extends AbstractTab
+{
+ public TabCurses()
+ {
+ super(0, 0, 0, new ItemStack(Items.ender_eye));
+ }
+
+ @Override
+ public void onTabClicked ()
+ {
+ JewelrycraftMod.netWrapper.sendToServer(new PacketKeyPressEvent(1));
+ }
+
+ @Override
+ public boolean shouldAddToList ()
+ {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java
index 6ba37ad..e35f305 100644
--- a/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java
+++ b/src/main/java/darkknight/jewelrycraft/client/TabRegistry.java
@@ -1,86 +1,86 @@
-package darkknight.jewelrycraft.client;
-
-import java.util.ArrayList;
-import java.util.List;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.inventory.GuiInventory;
-import net.minecraft.network.play.client.C0DPacketCloseWindow;
-import net.minecraftforge.client.event.GuiScreenEvent;
-import cpw.mods.fml.client.FMLClientHandler;
-import cpw.mods.fml.common.Loader;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import darkknight.jewelrycraft.client.*;
-
-/**
- * @author TinkersConstruct
- */
-public class TabRegistry
-{
- private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
-
- public static void registerTab(AbstractTab tab)
- {
- tabList.add(tab);
- }
-
- public static ArrayList<AbstractTab> getTabList()
- {
- return tabList;
- }
-
- @SideOnly (Side.CLIENT)
- @SubscribeEvent
- public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event)
- {
- if ((event.gui instanceof GuiInventory)){
- int xSize = 176;
- int ySize = 166;
- int guiLeft = (event.gui.width - xSize) / 2;
- int guiTop = (event.gui.height - ySize) / 2;
- if (!mc.thePlayer.getActivePotionEffects().isEmpty()) if (Loader.isModLoaded("NotEnoughItems")){
- try{
- // Check whether NEI is hidden and enabled
- Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
- Object hidden = c.getMethod("isHidden").invoke(null);
- Object enabled = c.getMethod("isEnabled").invoke(null);
- if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) if ((Boolean)hidden || !((Boolean)enabled)) guiLeft += 60;
- }
- catch(Exception e){}
- }else guiLeft += 60;
- updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
- addTabsToList(event.buttonList);
- }
- }
-
- private static Minecraft mc = FMLClientHandler.instance().getClient();
-
- public static void openInventoryGui()
- {
- mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
- GuiInventory inventory = new GuiInventory(mc.thePlayer);
- mc.displayGuiScreen(inventory);
- }
-
- public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton)
- {
- int count = 1;
- for(int i = 0; i < tabList.size(); i++){
- AbstractTab t = tabList.get(i);
- if (t.shouldAddToList()){
- t.id = count;
- t.xPosition = cornerX + 151 + (t.id==1?9:0);
- t.yPosition = cornerY + 64;
- t.enabled = !t.getClass().equals(selectedButton);
- count++;
- }
- }
- }
-
- public static void addTabsToList(List buttonList)
- {
- for(AbstractTab tab: tabList)
- if (tab.shouldAddToList() && tab.enabled) buttonList.add(tab);
- }
+package darkknight.jewelrycraft.client;
+
+import java.util.ArrayList;
+import java.util.List;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiInventory;
+import net.minecraft.network.play.client.C0DPacketCloseWindow;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import darkknight.jewelrycraft.client.*;
+
+/**
+ * @author TinkersConstruct
+ */
+public class TabRegistry {
+ private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
+
+ public static void registerTab(AbstractTab tab) {
+ tabList.add(tab);
+ }
+
+ public static ArrayList<AbstractTab> getTabList() {
+ return tabList;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @SubscribeEvent
+ public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
+ if ((event.gui instanceof GuiInventory)) {
+ int xSize = 176;
+ int ySize = 166;
+ int guiLeft = (event.gui.width - xSize) / 2;
+ int guiTop = (event.gui.height - ySize) / 2;
+ if (!mc.thePlayer.getActivePotionEffects().isEmpty()) if (Loader.isModLoaded("NotEnoughItems")) {
+ try {
+ // Check whether NEI is hidden and enabled
+ Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
+ Object hidden = c.getMethod("isHidden").invoke(null);
+ Object enabled = c.getMethod("isEnabled").invoke(null);
+ if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) if ((Boolean) hidden || !((Boolean) enabled)) guiLeft += 60;
+ } catch (Exception e) {
+ }
+ } else guiLeft += 60;
+ updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
+ addTabsToList(event.buttonList);
+ }
+ }
+
+ private static Minecraft mc = FMLClientHandler.instance().getClient();
+
+ public static void openInventoryGui() {
+ mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
+ GuiInventory inventory = new GuiInventory(mc.thePlayer);
+ mc.displayGuiScreen(inventory);
+ }
+
+ public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton) {
+ int count = 0;
+ for (int i = 0; i < tabList.size(); i++) {
+ AbstractTab t = tabList.get(i);
+ if (t.shouldAddToList()) {
+ if (selectedButton.equals(TabCurses.class)) {
+ t.xPosition = cornerX + 195;
+ t.yPosition = cornerY + count*20;
+ }else if (selectedButton.equals(TabJewelry.class)) {
+ t.xPosition = cornerX + 140 + count * 20;
+ t.yPosition = cornerY + 64;
+ } else {
+ t.xPosition = cornerX + 131 + count * 20;
+ t.yPosition = cornerY + 64;
+ }
+ t.enabled = !t.getClass().equals(selectedButton);
+ if (t.enabled) count++;
+ }
+ }
+ }
+
+ public static void addTabsToList(List buttonList) {
+ for (AbstractTab tab : tabList)
+ if (tab.shouldAddToList() && tab.enabled) buttonList.add(tab);
+ }
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java
index 5489911..2b3faa0 100644
--- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiCurseInfo.java
@@ -1,58 +1,133 @@
-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++;
- }
- }
- }
- }
+package darkknight.jewelrycraft.client.gui;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.inventory.GuiContainer;
+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 org.lwjgl.opengl.GL11;
+
+import darkknight.jewelrycraft.api.Curse;
+import darkknight.jewelrycraft.client.TabCurses;
+import darkknight.jewelrycraft.client.TabRegistry;
+import darkknight.jewelrycraft.events.KeyBindings;
+import darkknight.jewelrycraft.util.PlayerUtils;
+import darkknight.jewelrycraft.util.Variables;
+
+public class GuiCurseInfo extends GuiContainer {
+ World world;
+ EntityPlayer player;
+ ResourceLocation texture;
+
+ public GuiCurseInfo(Container container, World world, EntityPlayer player, ResourceLocation texture) {
+ super(container);
+ this.world = world;
+ this.player = player;
+ this.texture = texture;
+ xSize = 214;
+ ySize = 166;
+ }
+
+ 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++;
+ // }
+ // }
+ // }
+ }
+
+ @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);
+ int ind = 0;
+ int size = 32;
+ if (player != null) {
+ NBTTagCompound playerInfo = PlayerUtils.getModPlayerPersistTag(player, Variables.MODID);
+ if (!playerInfo.hasNoTags()) {
+ for (Curse curse : Curse.getCurseList())
+ if (playerInfo.getInteger(curse.getName()) > 0) {
+ mc.renderEngine.bindTexture(Variables.MISC_TEXTURE);
+ drawTexturedModalRect(guiLeft + 43, guiTop + 5 + (size - 8) * ind, 0, 32, 112, 22);
+ if (playerInfo.getInteger(curse.getName()) == 1) {
+ GL11.glPushMatrix();
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GL11.glColor4f(1f, 1f, 1f, 0.5f);
+ drawTexturedModalRect(guiLeft + 134, guiTop + 8 + (size - 8) * ind, 3 * 16, 0, 16, 16);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glPopMatrix();
+ }
+ int halfDescrSize = fontRendererObj.getStringWidth(curse.getDescription()) / 2;
+ mc.renderEngine.bindTexture(new ResourceLocation(Variables.MODID, "textures/gui/" + curse.getTexturePack() + ".png"));
+ int tag = curse.getTextureID();
+ GL11.glPushMatrix();
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glScalef(0.5f, 0.5f, 0.0f);
+ drawTexturedModalRect(guiLeft*2 + 100, guiTop*2 + 16 + ind * 48, tag % 8 * 32, tag / 8 * 32, 32, 32);
+ GL11.glPopMatrix();
+ this.drawString(fontRendererObj, curse.getDisplayName(), guiLeft + 70, guiTop + 12 + ind * (size - 8), 0xffffff);
+ // this.drawCenteredString(fontRendererObj,
+ // curse.getDescription(), this.width/2, 30 + ind * 34,
+ // 0xffffff);
+ ind++;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
+ }
+
+ @Override
+ protected void keyTyped(char charecter, int key)
+ {
+ super.keyTyped(charecter, key);
+ if (key == KeyBindings.curses.getKeyCode()) mc.thePlayer.closeScreen();
+ }
+
+ @Override
+ public void initGui() {
+ super.initGui();
+ int cornerX = guiLeft;
+ int cornerY = guiTop;
+ this.buttonList.clear();
+ TabRegistry.updateTabValues(cornerX, cornerY, TabCurses.class);
+ TabRegistry.addTabsToList(this.buttonList);
+ }
+
+ protected void mouseClicked(int x, int y, int id) {
+ super.mouseClicked(x, y, id);
+ }
} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java
index b9427d7..e91abc0 100644
--- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiHandler.java
@@ -1,92 +1,93 @@
-package darkknight.jewelrycraft.client.gui;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.InventoryBasic;
-import net.minecraft.tileentity.TileEntityChest;
-import net.minecraft.util.ResourceLocation;
-import net.minecraft.world.World;
-import cpw.mods.fml.common.network.IGuiHandler;
-import cpw.mods.fml.common.network.NetworkRegistry;
-import darkknight.jewelrycraft.JewelrycraftMod;
-import darkknight.jewelrycraft.client.JewelryInventory;
-import darkknight.jewelrycraft.client.gui.container.ContainerCurseInfo;
-import darkknight.jewelrycraft.client.gui.container.ContainerGuide;
-import darkknight.jewelrycraft.client.gui.container.ContainerJewelryModifier;
-import darkknight.jewelrycraft.client.gui.container.ContainerJewelryTab;
-import darkknight.jewelrycraft.client.gui.container.ContainerRingChest;
-import darkknight.jewelrycraft.util.Variables;
-
-public class GuiHandler implements IGuiHandler
-{
- ResourceLocation pageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePage.png");
- ResourceLocation flippedPageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePageFlip.png");
- ResourceLocation chestTexture = new ResourceLocation(Variables.MODID, "textures/gui/chest_ring.png");
- ResourceLocation jewelryInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_tab.png");
- ResourceLocation jewlryModTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_modifier.png");
-
- /**
- *
- */
- public GuiHandler()
- {
- NetworkRegistry.INSTANCE.registerGuiHandler(JewelrycraftMod.instance, this);
- }
-
- /**
- * @param ID
- * @param player
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
- */
- @Override
- public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- switch(ID)
- {
- case 0:
- return new ContainerRingChest(player.inventory, (TileEntityChest)world.getTileEntity(x, y, z));
- case 1:
- return new ContainerGuide();
- case 2:
- return new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player));
- case 3:
- return new ContainerJewelryModifier(player.inventory, new InventoryBasic("ItemModifier", false, 37));
- case 4:
- return new ContainerCurseInfo();
- default:
- return null;
- }
- }
-
- /**
- * @param ID
- * @param player
- * @param world
- * @param x
- * @param y
- * @param z
- * @return
- */
- @Override
- public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
- {
- switch(ID)
- {
- case 0:
- return new GuiRingChest((ContainerRingChest)getServerGuiElement(ID, player, world, x, y, z), chestTexture);
- case 1:
- return new GuiGuide((ContainerGuide)getServerGuiElement(ID, player, world, x, y, z), world, pageTexture, flippedPageTexture);
- case 2:
- return new GuiJewelry(new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)), jewelryInvTexture);
- case 3:
- return new GuiJewelryModifier((ContainerJewelryModifier)getServerGuiElement(ID, player, world, x, y, z), jewlryModTexture);
- case 4:
- return new GuiCurseInfo((ContainerCurseInfo)getServerGuiElement(ID, player, world, x, y, z), world, player);
- default:
- return null;
- }
- }
-}
+package darkknight.jewelrycraft.client.gui;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.InventoryBasic;
+import net.minecraft.tileentity.TileEntityChest;
+import net.minecraft.util.ResourceLocation;
+import net.minecraft.world.World;
+import cpw.mods.fml.common.network.IGuiHandler;
+import cpw.mods.fml.common.network.NetworkRegistry;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.client.JewelryInventory;
+import darkknight.jewelrycraft.client.gui.container.ContainerCurseInfo;
+import darkknight.jewelrycraft.client.gui.container.ContainerGuide;
+import darkknight.jewelrycraft.client.gui.container.ContainerJewelryModifier;
+import darkknight.jewelrycraft.client.gui.container.ContainerJewelryTab;
+import darkknight.jewelrycraft.client.gui.container.ContainerRingChest;
+import darkknight.jewelrycraft.util.Variables;
+
+public class GuiHandler implements IGuiHandler
+{
+ ResourceLocation pageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePage.png");
+ ResourceLocation flippedPageTexture = new ResourceLocation(Variables.MODID, "textures/gui/guidePageFlip.png");
+ ResourceLocation chestTexture = new ResourceLocation(Variables.MODID, "textures/gui/chest_ring.png");
+ ResourceLocation jewelryInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_tab.png");
+ ResourceLocation cursesInvTexture = new ResourceLocation(Variables.MODID, "textures/gui/curses_tab.png");
+ ResourceLocation jewlryModTexture = new ResourceLocation(Variables.MODID, "textures/gui/jewelry_modifier.png");
+
+ /**
+ *
+ */
+ public GuiHandler()
+ {
+ NetworkRegistry.INSTANCE.registerGuiHandler(JewelrycraftMod.instance, this);
+ }
+
+ /**
+ * @param ID
+ * @param player
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
+ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
+ {
+ switch(ID)
+ {
+ case 0:
+ return new ContainerRingChest(player.inventory, (TileEntityChest)world.getTileEntity(x, y, z));
+ case 1:
+ return new ContainerGuide();
+ case 2:
+ return new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player));
+ case 3:
+ return new ContainerJewelryModifier(player.inventory, new InventoryBasic("ItemModifier", false, 37));
+ case 4:
+ return new ContainerCurseInfo();
+ default:
+ return null;
+ }
+ }
+
+ /**
+ * @param ID
+ * @param player
+ * @param world
+ * @param x
+ * @param y
+ * @param z
+ * @return
+ */
+ @Override
+ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
+ {
+ switch(ID)
+ {
+ case 0:
+ return new GuiRingChest((ContainerRingChest)getServerGuiElement(ID, player, world, x, y, z), chestTexture);
+ case 1:
+ return new GuiGuide((ContainerGuide)getServerGuiElement(ID, player, world, x, y, z), world, pageTexture, flippedPageTexture);
+ case 2:
+ return new GuiJewelry(new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)), jewelryInvTexture);
+ case 3:
+ return new GuiJewelryModifier((ContainerJewelryModifier)getServerGuiElement(ID, player, world, x, y, z), jewlryModTexture);
+ case 4:
+ return new GuiCurseInfo((ContainerCurseInfo)getServerGuiElement(ID, player, world, x, y, z), world, player, cursesInvTexture);
+ default:
+ return null;
+ }
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java
index fc4f15b..3ca0a20 100644
--- a/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/GuiJewelry.java
@@ -1,74 +1,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);
- }
-}
+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);
+ }
+}