From 420faddca46e70e3a70def168fb4e452ef193b0d Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 21 Feb 2015 21:31:16 +0000 Subject: Added just a butt ton of stuff, also thanks to pau101 for helping me with the Hand Pedestal animation :) --- .../jewelrycraft/container/ContainerGuide.java | 10 +- .../container/ContainerJewelryTab.java | 96 +++++---- .../jewelrycraft/container/ContainerRingChest.java | 59 +++--- .../jewelrycraft/container/GuiHandler.java | 41 +++- .../jewelrycraft/container/GuiRectangle.java | 48 ++++- java/darkknight/jewelrycraft/container/GuiTab.java | 53 ++++- .../jewelrycraft/container/GuiTabBlocks.java | 128 ++++++------ .../container/GuiTabGemsAndIngots.java | 46 ++-- .../jewelrycraft/container/GuiTabItems.java | 164 +++++---------- .../jewelrycraft/container/GuiTabModifiers.java | 49 +++-- .../jewelrycraft/container/JewelryInventory.java | 111 +++++++--- java/darkknight/jewelrycraft/container/Page.java | 232 +++++++++------------ .../jewelrycraft/container/SlotBracelet.java | 52 +++++ .../jewelrycraft/container/SlotEarrings.java | 52 +++++ .../jewelrycraft/container/SlotNecklace.java | 52 +++++ .../jewelrycraft/container/SlotRing.java | 19 ++ .../jewelrycraft/container/SlotRingChest.java | 21 +- 17 files changed, 766 insertions(+), 467 deletions(-) create mode 100644 java/darkknight/jewelrycraft/container/SlotBracelet.java create mode 100644 java/darkknight/jewelrycraft/container/SlotEarrings.java create mode 100644 java/darkknight/jewelrycraft/container/SlotNecklace.java (limited to 'java/darkknight/jewelrycraft/container') diff --git a/java/darkknight/jewelrycraft/container/ContainerGuide.java b/java/darkknight/jewelrycraft/container/ContainerGuide.java index 53f5bb8..b6513a3 100644 --- a/java/darkknight/jewelrycraft/container/ContainerGuide.java +++ b/java/darkknight/jewelrycraft/container/ContainerGuide.java @@ -9,10 +9,16 @@ import net.minecraft.inventory.Container; public class ContainerGuide extends Container { + /** + * + */ public ContainerGuide() - { - } + {} + /** + * @param entityplayer + * @return + */ @Override public boolean canInteractWith(EntityPlayer entityplayer) { diff --git a/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java b/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java index e33976a..701b338 100644 --- a/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java +++ b/java/darkknight/jewelrycraft/container/ContainerJewelryTab.java @@ -1,65 +1,87 @@ package darkknight.jewelrycraft.container; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.item.ItemBracelet; +import darkknight.jewelrycraft.item.ItemEarrings; +import darkknight.jewelrycraft.item.ItemNecklace; +import darkknight.jewelrycraft.item.ItemRing; public class ContainerJewelryTab extends Container { - public ContainerJewelryTab(EntityPlayer player, InventoryPlayer inv) + + /** + * @param player + * @param inv + * @param extra + */ + public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra) { int x, y; // Rings - for (x = 0; x <= 9; x++) - this.addSlotToContainer(new SlotRing(new JewelryInventory(), x, 8 + x * 18, 7)); - + for(x = 0; x <= 9; x++) + addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7)); + // Bracelets + for(x = 10; x <= 13; x++) + addSlotToContainer(new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26)); + // Necklaces + for(x = 14; x <= 16; x++) + addSlotToContainer(new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45)); + // Earrings + addSlotToContainer(new SlotEarrings(extra, 17, 8, 64)); // Hotbar - for (x = 0; x < 9; ++x) - this.addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142)); - + for(x = 0; x < 9; ++x) + addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142)); // Inventory - for (x = 0; x < 3; ++x) - for (y = 0; y < 9; ++y) - this.addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18)); - + for(x = 0; x < 3; ++x) + for(y = 0; y < 9; ++y) + addSlotToContainer(new Slot(inv, 9 + y + x * 9, 17 + y * 18, 84 + x * 18)); } + /** + * @param player + * @return + */ @Override public boolean canInteractWith(EntityPlayer player) { return true; } + /** + * @param player + * @param slotID + * @return + */ @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get(par2); - -// if (slot != null && slot.getHasStack()) -// { -// ItemStack itemstack1 = slot.getStack(); -// itemstack = itemstack1.copy(); -// -// if (par2 < 27) -// { -// if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return null; } -// } -// else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { return null; } -// -// if (itemstack1.stackSize == 0) -// { -// slot.putStack((ItemStack) null); -// } -// else -// { -// slot.onSlotChanged(); -// } -// } -// + Slot slot = (Slot)inventorySlots.get(slotID); + if (slot != null && slot.getHasStack()){ + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + if (slotID < 18){ + if (!mergeItemStack(itemstack1, 18, 18 + 36, true)) return null; + slot.onSlotChange(itemstack1, itemstack); + }else if (itemstack1.getItem() instanceof ItemRing){ + if (!mergeItemStack(itemstack1, 0, 10, false)) return null; + }else if (itemstack1.getItem() instanceof ItemBracelet){ + if (!mergeItemStack(itemstack1, 10, 14, false)) return null; + }else if (itemstack1.getItem() instanceof ItemNecklace){ + if (!mergeItemStack(itemstack1, 14, 17, false)) return null; + }else if (itemstack1.getItem() instanceof ItemEarrings){ + if (!mergeItemStack(itemstack1, 17, 18, false)) return null; + }else{ + if (!mergeItemStack(itemstack1, 18, 54, true)) return null; + slot.onSlotChange(itemstack1, itemstack); + } + if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null); + else slot.onSlotChanged(); + } return itemstack; } } diff --git a/java/darkknight/jewelrycraft/container/ContainerRingChest.java b/java/darkknight/jewelrycraft/container/ContainerRingChest.java index 91bb346..925ded7 100644 --- a/java/darkknight/jewelrycraft/container/ContainerRingChest.java +++ b/java/darkknight/jewelrycraft/container/ContainerRingChest.java @@ -11,56 +11,53 @@ public class ContainerRingChest extends Container { public TileEntityChest theChest; + /** + * @param inv + * @param chest + */ public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest) { theChest = chest; - int x, y; - - for (x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(inv, x, 8 + (18 * x), 142, x == inv.currentItem)); - for (y = 0; y < 3; y++) - for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + (y * 9), 8 + (18 * x), 84 + (y * 18))); - - for (y = 0; y < 3; y++) - for (x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(chest, 26 - (x + (y * 9)), 8 + (18 * (8 - x)), 17 + ((2 - y) * 18), false)); + for(x = 0; x < 9; x++) + addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, x == inv.currentItem)); + for(y = 0; y < 3; y++) + for(x = 0; x < 9; x++) + addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, 84 + y * 18)); + for(y = 0; y < 3; y++) + for(x = 0; x < 9; x++) + addSlotToContainer(new SlotRingChest(chest, 26 - (x + y * 9), 8 + 18 * (8 - x), 17 + (2 - y) * 18, false)); } + /** + * @param player + * @return + */ @Override public boolean canInteractWith(EntityPlayer player) { return true; } + /** + * @param par1EntityPlayer + * @param par2 + * @return + */ @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; - Slot slot = (Slot) this.inventorySlots.get(par2); - - if (slot != null && slot.getHasStack()) - { + Slot slot = (Slot)inventorySlots.get(par2); + if (slot != null && slot.getHasStack()){ ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - - if (par2 < 27) - { - if (!this.mergeItemStack(itemstack1, 27, this.inventorySlots.size(), true)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 0, 27, false)) { return null; } - - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack) null); - } - else - { - slot.onSlotChanged(); - } + if (par2 < 27){ + if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null; + }else if (!mergeItemStack(itemstack1, 0, 27, false)) return null; + if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null); + else slot.onSlotChanged(); } - return itemstack; } } diff --git a/java/darkknight/jewelrycraft/container/GuiHandler.java b/java/darkknight/jewelrycraft/container/GuiHandler.java index 7773a38..6ebd3e9 100644 --- a/java/darkknight/jewelrycraft/container/GuiHandler.java +++ b/java/darkknight/jewelrycraft/container/GuiHandler.java @@ -2,6 +2,7 @@ package darkknight.jewelrycraft.container; import net.minecraft.entity.player.EntityPlayer; 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; @@ -12,38 +13,64 @@ import darkknight.jewelrycraft.client.GuiRingChest; public class GuiHandler implements IGuiHandler { + ResourceLocation pageTexture = new ResourceLocation("jewelrycraft", "textures/gui/guidePage.png"); + ResourceLocation flippedPageTexture = new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"); + ResourceLocation chestTexture = new ResourceLocation("jewelrycraft", "textures/gui/chest_ring.png"); + ResourceLocation jewelryInvTexture = new ResourceLocation("jewelrycraft", "textures/gui/jewelry_tab.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) + switch(ID) { case 0: - return new ContainerRingChest(player.inventory, (TileEntityChest) world.getTileEntity(x, y, z)); + return new ContainerRingChest(player.inventory, (TileEntityChest)world.getTileEntity(x, y, z)); case 1: return new ContainerGuide(); case 2: - return new ContainerJewelryTab(player, player.inventory); + return new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)); 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) + switch(ID) { case 0: - return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z)); + 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); + return new GuiGuide((ContainerGuide)getServerGuiElement(ID, player, world, x, y, z), world, pageTexture, flippedPageTexture); case 2: - return new GuiJewelry(new ContainerJewelryTab(player, player.inventory)); + return new GuiJewelry(new ContainerJewelryTab(player, player.inventory, new JewelryInventory(player)), jewelryInvTexture); default: return null; } diff --git a/java/darkknight/jewelrycraft/container/GuiRectangle.java b/java/darkknight/jewelrycraft/container/GuiRectangle.java index 3ecf20c..50b7cd5 100644 --- a/java/darkknight/jewelrycraft/container/GuiRectangle.java +++ b/java/darkknight/jewelrycraft/container/GuiRectangle.java @@ -1,19 +1,22 @@ package darkknight.jewelrycraft.container; import java.util.Arrays; - import net.minecraft.item.ItemStack; - import darkknight.jewelrycraft.client.GuiGuide; public class GuiRectangle { - private int x; private int y; private int w; private int h; + /** + * @param x + * @param y + * @param w + * @param h + */ public GuiRectangle(int x, int y, int w, int h) { this.x = x; @@ -22,42 +25,71 @@ public class GuiRectangle this.h = h; } + /** + * @param gui + * @param mouseX + * @param mouseY + * @return + */ public boolean inRect(GuiGuide gui, int mouseX, int mouseY) { mouseX -= gui.getLeft(); mouseY -= gui.getTop(); - return x <= mouseX && mouseX <= x + w && y <= mouseY && mouseY <= y + h; } + /** + * @param x + */ public void setX(int x) { this.x = x; } + /** + * @param y + */ public void setY(int y) { this.y = y; } + /** + * @param gui + * @param srcX + * @param srcY + */ public void draw(GuiGuide gui, int srcX, int srcY) { gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, w, h); } + /** + * @param gui + * @param srcX + * @param srcY + * @param width + * @param height + */ public void draw(GuiGuide gui, int srcX, int srcY, int width, int height) { gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, width, height); } + /** + * @param gui + * @param mouseX + * @param mouseY + * @param str + */ public void drawString(GuiGuide gui, int mouseX, int mouseY, String str) { - if (inRect(gui, mouseX, mouseY)) - { - gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop()); - } + if (inRect(gui, mouseX, mouseY)) gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop()); } + /** + * @return + */ public ItemStack getIcon() { return null; diff --git a/java/darkknight/jewelrycraft/container/GuiTab.java b/java/darkknight/jewelrycraft/container/GuiTab.java index 959fef7..e315d3a 100644 --- a/java/darkknight/jewelrycraft/container/GuiTab.java +++ b/java/darkknight/jewelrycraft/container/GuiTab.java @@ -4,12 +4,16 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import darkknight.jewelrycraft.client.GuiGuide; -@SideOnly(Side.CLIENT) +@SideOnly (Side.CLIENT) public abstract class GuiTab extends GuiRectangle { int values, del; private String name; + /** + * @param name + * @param id + */ public GuiTab(String name, int id) { super(-62, 10 + 19 * id, 19, 18); @@ -18,30 +22,63 @@ public abstract class GuiTab extends GuiRectangle del = 0; } + /** + * @return + */ public String getName() { return name; } + /** + * @param gui + * @param x + * @param y + * @param page + */ public abstract void drawBackground(GuiGuide gui, int x, int y, int page); + /** + * @param gui + * @param x + * @param y + * @param page + */ public abstract void drawForeground(GuiGuide gui, int x, int y, int page); + /** + * @param gui + * @param x + * @param y + * @param button + */ public void mouseClick(GuiGuide gui, int x, int y, int button) - { - } + {} + /** + * @param gui + * @param x + * @param y + * @param button + * @param timeSinceClicked + */ public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) - { - } + {} + /** + * @param gui + * @param x + * @param y + * @param button + */ public void mouseReleased(GuiGuide gui, int x, int y, int button) - { - } + {} + /** + * @return + */ public int getMaxPages() { return 1; } - } diff --git a/java/darkknight/jewelrycraft/container/GuiTabBlocks.java b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java index 237466c..c48aaa8 100644 --- a/java/darkknight/jewelrycraft/container/GuiTabBlocks.java +++ b/java/darkknight/jewelrycraft/container/GuiTabBlocks.java @@ -1,7 +1,7 @@ package darkknight.jewelrycraft.container; -import java.util.ArrayList; - +import java.awt.Desktop; +import java.net.URL; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -13,23 +13,35 @@ import darkknight.jewelrycraft.item.ItemList; public class GuiTabBlocks extends GuiTab { + /** + * @param id + */ public GuiTabBlocks(int id) { super("Blocks", id); } + /** + * @return + */ + @Override public ItemStack getIcon() { return new ItemStack(BlockList.jewelAltar); } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawBackground(GuiGuide gui, int x, int y, int page) { String text = ""; - ArrayList items = new ArrayList(); - int xPos = (page % 2 == 0) ? 107 : -35; - switch (page) + int xPos = page % 2 == 0 ? 107 : -35; + switch(page) { case 1: text = "This ore is extremely rare and can be found only between Y-level 5 and 8. It can only be mined using a diamond pickaxe."; @@ -37,10 +49,7 @@ public class GuiTabBlocks extends GuiTab break; case 2: text = "The Shadow Block is crafted using 9 shadow ingots. Magicians believed it held the ability to merge with the shadows. It becomes more transparent as it"; - items.add(new ItemStack(BlockList.shadowBlock)); - for (int i = 1; i <= 9; i++) - items.add(new ItemStack(ItemList.shadowIngot)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.shadowBlock), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot), new ItemStack(ItemList.shadowIngot)); break; case 3: text = "gets darker. If a comparator is attached to it, the output strength will be equal to the value of darkness it is in."; @@ -48,17 +57,7 @@ public class GuiTabBlocks extends GuiTab break; case 4: text = "The smelter is one of the first blocks needed to get started with Jewelrycraft. Requiring just some cobble and a couple buckets. It is required in order to"; - items.add(new ItemStack(BlockList.smelter)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(new ItemStack(Items.bucket)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(null); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(new ItemStack(Items.lava_bucket)); - items.add(new ItemStack(Blocks.cobblestone)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.smelter), new ItemStack(Blocks.cobblestone), new ItemStack(Items.bucket), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Items.lava_bucket), new ItemStack(Blocks.cobblestone)); break; case 5: text = "melt ingots or even ores which can be made into rings, necklaces, bracelets or earrings. To use the block all you need to do is right click on it with any ore or ingot. It can melt multimple ingots/ores at a time. Crouch (default: Shift) + Right Click will remove all items"; @@ -70,14 +69,7 @@ public class GuiTabBlocks extends GuiTab break; case 7: text = "The molder is a key piece in creating jewellery. You need to pour the molten metal out of the smelter somewhere. That somewhere is the"; - - items.add(new ItemStack(BlockList.molder)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(null); - items.add(new ItemStack(Blocks.cobblestone)); - for (int i = 1; i <= 3; i++) - items.add(new ItemStack(Blocks.cobblestone)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.molder), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone)); break; case 8: text = "molder. But before pouring the molten metal in it, you must first add a mold. You can do that by simply right clicking the block with the mold of your choice. If you want to get the mold out, simply crouch and Right Click it with an empty hand. Once you"; @@ -93,16 +85,7 @@ public class GuiTabBlocks extends GuiTab del++; if (del >= 300) del = 0; if (values >= 4) values = 0; - items.add(new ItemStack(BlockList.jewelCraftingTable)); - for (int i = 1; i <= 3; i++) - items.add(new ItemStack(Blocks.planks, 1, values)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(null); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(new ItemStack(Blocks.cobblestone)); - items.add(null); - items.add(new ItemStack(Blocks.cobblestone)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.jewelCraftingTable), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.planks, 1, values), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.cobblestone), null, new ItemStack(Blocks.cobblestone)); break; case 11: text = "can find a list with all possible gems in this guide). Crouch + Right Click to retreive placed items. Left Click the block to see the progress the crafting has made. Once the crafting is done, Left Click the block to get the item. You are able to recraft a"; @@ -114,17 +97,7 @@ public class GuiTabBlocks extends GuiTab break; case 13: text = "This block can store any jewellery in it and activate their effects as it were a player. To do that simply right click the block with a jewellery. Crouch +"; - items.add(new ItemStack(BlockList.jewelAltar)); - items.add(new ItemStack(Blocks.end_stone)); - items.add(new ItemStack(Blocks.wool, 1, 5)); - items.add(new ItemStack(Blocks.end_stone)); - items.add(new ItemStack(Blocks.nether_brick)); - items.add(new ItemStack(Blocks.wool, 1, 5)); - items.add(new ItemStack(Blocks.nether_brick)); - items.add(new ItemStack(Blocks.nether_brick)); - items.add(new ItemStack(Blocks.nether_brick)); - items.add(new ItemStack(Blocks.nether_brick)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.jewelAltar), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.end_stone), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.wool, 1, 5), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick), new ItemStack(Blocks.nether_brick)); break; case 14: text = "Right Click to retreive the jewellery."; @@ -132,17 +105,7 @@ public class GuiTabBlocks extends GuiTab break; case 15: text = "The Storage Displayer, as the name suggests, can store a large amount (Up to: " + Integer.MAX_VALUE + ") of a single item/block placed in it. It will"; - items.add(new ItemStack(BlockList.displayer)); - items.add(null); - items.add(new ItemStack(Items.iron_ingot)); - items.add(null); - items.add(new ItemStack(Items.iron_ingot)); - items.add(new ItemStack(Items.iron_ingot)); - items.add(new ItemStack(Items.iron_ingot)); - items.add(new ItemStack(Blocks.emerald_block)); - items.add(new ItemStack(Blocks.emerald_block)); - items.add(new ItemStack(Blocks.emerald_block)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.displayer), null, new ItemStack(Items.iron_ingot), null, new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Items.iron_ingot), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block), new ItemStack(Blocks.emerald_block)); break; case 16: text = "display all possible infromation about the object in it, such as the name, durability, enchantments etc. To store something in it simply right click with that object on it and the whole amount of items or blocks you are holding will be immediately stored inside."; @@ -156,19 +119,60 @@ public class GuiTabBlocks extends GuiTab text = "get a whole stack, Crouch + Left Click on it. In creative mode you can simply hold Right Click on a displayer containing an object and it will add 64 of it with every right click, without it being in your inventory."; Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); break; + case 19: + text = "This mysterious shaped block is used in the ritual. The acient ones claimed it had the power to travel through worlds. They would use these to offer"; + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.handPedestal), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), new ItemStack(Blocks.cobblestone_wall), null, new ItemStack(Blocks.stonebrick), null, new ItemStack(Blocks.stone_slab, 1, 5), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stone_slab, 1, 5)); + break; + case 20: + text = "sacrifices to 'The Dark One' in exchange for unimaginable powers."; + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 21: + text = "The Cursed Eye is an ancient artifact also known as 'The Dark One's Eye'. It is part of the sacrifice ritual the ancient ones talk about. Be careful"; + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(BlockList.shadowEye), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Items.ender_eye), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stained_hardened_clay, 1, 15), new ItemStack(Blocks.stonebrick)); + break; + case 22: + String link = "HERE"; + if (x >= gui.getLeft() + 130 && x <= gui.getLeft() + 160 && y >= gui.getTop() + 40 && y <= gui.getTop() + 50) link = EnumChatFormatting.DARK_BLUE + "HERE" + EnumChatFormatting.BLACK; + text = "though, for He sees everything. To see how to create the ritual click " + link + " for a link with the pictures (will be part of the book later)."; + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; default: ; } } + /** + * @return + */ + @Override public int getMaxPages() { - return 17; + return 21; } + /** + * @param gui + * @param x + * @param y + * @param button + */ @Override - public void drawForeground(GuiGuide gui, int x, int y, int page) + public void mouseClick(GuiGuide gui, int x, int y, int button) { + if (gui.page == 21 && x >= gui.getLeft() + 130 && x <= gui.getLeft() + 160 && y >= gui.getTop() + 40 && y <= gui.getTop() + 50) try{ + Desktop.getDesktop().browse(new URL("http://imgur.com/a/Zk0LW").toURI()); + } + catch(Exception e){} } + /** + * @param gui + * @param x + * @param y + * @param page + */ + @Override + public void drawForeground(GuiGuide gui, int x, int y, int page) + {} } diff --git a/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java b/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java index 7e9c815..aa41611 100644 --- a/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java +++ b/java/darkknight/jewelrycraft/container/GuiTabGemsAndIngots.java @@ -3,60 +3,76 @@ package darkknight.jewelrycraft.container; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; - import org.lwjgl.opengl.GL11; - import darkknight.jewelrycraft.client.GuiGuide; import darkknight.jewelrycraft.util.JewelrycraftUtil; public class GuiTabGemsAndIngots extends GuiTab { + + /** + * @param id + */ public GuiTabGemsAndIngots(int id) { super("Gems and ingots", id); } + /** + * @return + */ + @Override public ItemStack getIcon() { return new ItemStack(Items.emerald); } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawBackground(GuiGuide gui, int x, int y, int page) { - int xPos = (page % 2 == 0) ? 107 : -35; + int xPos = page % 2 == 0 ? 107 : -35; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - for (int i = (page - 1) * 9; i < page * 9; i++) - if (i < JewelrycraftUtil.gem.size()) - { + for(int i = (page - 1) * 9; i < page * 9; i++) + if (i < JewelrycraftUtil.gem.size()){ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Gems", gui.getLeft() + xPos + 40, gui.getTop(), 0); gui.renderItem(JewelrycraftUtil.gem.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f); gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.gem.get(i).getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0); GL11.glDisable(GL11.GL_LIGHTING); } - page -= (JewelrycraftUtil.gem.size() / 9 + 1); - for (int i = (page - 1) * 9; i < page * 9; i++) - { - if (i < JewelrycraftUtil.metal.size() && page > 0) - { + page -= JewelrycraftUtil.gem.size() / 9 + 1; + for(int i = (page - 1) * 9; i < page * 9; i++) + if (i < JewelrycraftUtil.metal.size() && page > 0){ gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + "Ingots", gui.getLeft() + xPos + 40, gui.getTop(), 0); gui.renderItem(JewelrycraftUtil.metal.get(i).copy(), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16 * (i - 9 * (page - 1)), 30f); gui.getFont().drawString(String.format("%-1.18s", JewelrycraftUtil.metal.get(i).copy().getDisplayName()), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16 * (i - 9 * (page - 1)), 0); GL11.glDisable(GL11.GL_LIGHTING); } - } GL11.glDisable(GL11.GL_BLEND); } + /** + * @return + */ + @Override public int getMaxPages() { return JewelrycraftUtil.gem.size() / 9 + JewelrycraftUtil.metal.size() / 9 + 2; } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawForeground(GuiGuide gui, int x, int y, int page) - { - } - + {} } diff --git a/java/darkknight/jewelrycraft/container/GuiTabItems.java b/java/darkknight/jewelrycraft/container/GuiTabItems.java index 5950218..03069b9 100644 --- a/java/darkknight/jewelrycraft/container/GuiTabItems.java +++ b/java/darkknight/jewelrycraft/container/GuiTabItems.java @@ -2,8 +2,6 @@ package darkknight.jewelrycraft.container; import java.awt.Desktop; import java.net.URL; -import java.util.ArrayList; - import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -17,43 +15,43 @@ import darkknight.jewelrycraft.util.JewelrycraftUtil; public class GuiTabItems extends GuiTab { + /** + * @param id + */ public GuiTabItems(int id) { super("Items", id); } + /** + * @return + */ + @Override public ItemStack getIcon() { return new ItemStack(ItemList.thiefGloves); } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawBackground(GuiGuide gui, int x, int y, int page) { String text = ""; - ArrayList items = new ArrayList(); - int xPos = (page % 2 == 0) ? 107 : -35; - switch (page) + int xPos = page % 2 == 0 ? 107 : -35; + switch(page) { case 1: - text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewellery work."; - items.add(new ItemStack(BlockList.shadowOre)); - items.add(new ItemStack(ItemList.shadowIngot)); - Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y); + text = "Shadow ingots are obtained by smelting shadow ore. They are used in a few recipes and an important key for making some jewelry work."; + Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, new ItemStack(BlockList.shadowOre), new ItemStack(ItemList.shadowIngot)); break; case 2: text = "These gloves give you the chance to steal the trades those pesky Testificates have to offer. To use these simply open their gui at least once, then Crouch and"; - items.add(new ItemStack(ItemList.thiefGloves)); - items.add(new ItemStack(ItemList.shadowIngot)); - items.add(null); - items.add(new ItemStack(ItemList.shadowIngot)); - items.add(new ItemStack(Blocks.wool, 1, 15)); - items.add(new ItemStack(ItemList.shadowIngot)); - items.add(new ItemStack(Blocks.wool, 1, 15)); - items.add(new ItemStack(Blocks.wool, 1, 15)); - items.add(new ItemStack(ItemList.shadowIngot)); - items.add(new ItemStack(Blocks.wool, 1, 15)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.thiefGloves), new ItemStack(ItemList.shadowIngot), null, new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15), new ItemStack(Blocks.wool, 1, 15), new ItemStack(ItemList.shadowIngot), new ItemStack(Blocks.wool, 1, 15)); break; case 3: text = "right click on the them to hopefully steal the trades. If you traded with him before, then you have a chance of getting the traded emeralds back as well. This has a maximum of 10 uses before it breaks."; @@ -61,105 +59,43 @@ public class GuiTabItems extends GuiTab break; case 4: text = "In order to get the ingot back from the smelter you need a mold for it. However, this mold can't be used. It is too soft. It needs to be hardened in order for it to be used."; - items.add(new ItemStack(ItemList.clayMolds, 1, 0)); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.clayMolds, 1, 0), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball)); break; case 5: text = "To create a ring you need a mold for it. However, this one is too soft to be used. It needs to be hardened in order for it to be used."; - items.add(new ItemStack(ItemList.clayMolds, 1, 1)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 1), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null); break; case 6: text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used."; - items.add(new ItemStack(ItemList.clayMolds, 1, 2)); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 2), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null); break; case 7: text = "To create a bracelet you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used."; - items.add(new ItemStack(ItemList.clayMolds, 1, 3)); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - items.add(new ItemStack(Items.clay_ball)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 3), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball), new ItemStack(Items.clay_ball)); break; case 8: text = "To create a necklace you need a mold for it. However, this one can't be used. It is too soft. It needs to be hardened in order for it to be used."; - items.add(new ItemStack(ItemList.clayMolds, 1, 4)); - items.add(null); - items.add(null); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(new ItemStack(Items.clay_ball)); - items.add(null); - items.add(null); - items.add(null); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.clayMolds, 1, 4), null, null, null, new ItemStack(Items.clay_ball), null, new ItemStack(Items.clay_ball), null, null, null); break; case 9: if (del == 0) values++; del++; if (del >= 300) del = 0; if (values > 4) values = 0; - text = "By smelting a clay mold you get a harder version which can be used to create jewellery. Simply right click with this on a molder to attach it and you're ready to go."; - items.add(new ItemStack(ItemList.clayMolds, 1, values)); - items.add(new ItemStack(ItemList.molds, 1, values)); - Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y); + text = "By smelting a clay mold you get a harder version which can be used to create jewelry. Simply right click with this on a molder to attach it and you're ready to go."; + Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, x, y, new ItemStack(ItemList.clayMolds, 1, values), new ItemStack(ItemList.molds, 1, values)); break; case 10: - text = "Crystals don't do much as of yet. They can be dyed in any color and used as gems to create a nice jewellery."; - items.add(new ItemStack(ItemList.crystal, 1, 15)); - items.add(null); - items.add(new ItemStack(Blocks.glass)); - items.add(null); - items.add(new ItemStack(Blocks.glass)); - items.add(null); - items.add(new ItemStack(Blocks.glass)); - items.add(null); - items.add(new ItemStack(Blocks.glass)); - items.add(null); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + text = "Crystals don't do much as of yet. They can be dyed in any color and used as gems to create a nice jewelry."; + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, x, y, new ItemStack(ItemList.crystal, 1, 15), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null, new ItemStack(Blocks.glass), null); break; case 11: if (del == 0) values++; del++; if (del >= 300) del = 0; if (values >= 15) values = 0; - items.add(new ItemStack(ItemList.crystal, 1, values)); - items.add(new ItemStack(Items.dye, 1, values)); - items.add(new ItemStack(ItemList.crystal, 1, 15)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y); - items.removeAll(items); - items.add(new ItemStack(ItemList.crystal, 1, 15)); - items.add(new ItemStack(Items.dye, 1, 15)); - items.add(new ItemStack(ItemList.crystal, 1, values)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.crystal, 1, values), new ItemStack(Items.dye, 1, values), new ItemStack(ItemList.crystal, 1, 15)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, x, y, new ItemStack(ItemList.crystal, 1, 15), new ItemStack(Items.dye, 1, 15), new ItemStack(ItemList.crystal, 1, values)); break; case 12: if (del == 0) values++; @@ -167,10 +103,7 @@ public class GuiTabItems extends GuiTab if (del >= 300) del = 0; if (values > 4) values = 0; text = "It's this exact guide. I don't even know why you're reading this. I added this recipe in case you lose the original. Even if this is more helpful than NEI, I do suggest"; - items.add(new ItemStack(ItemList.guide)); - items.add(new ItemStack(ItemList.molds, 1, values)); - items.add(new ItemStack(Items.book)); - Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, x, y, new ItemStack(ItemList.guide), new ItemStack(ItemList.molds, 1, values), new ItemStack(Items.book)); break; case 13: String link = "HERE"; @@ -183,11 +116,11 @@ public class GuiTabItems extends GuiTab Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); break; case 15: - ItemStack item = new ItemStack(ItemList.bucket); + ItemStack item = new ItemStack(ItemList.bucket); if (del == 0) values++; del++; if (del >= 300) del = 0; - if (values > JewelrycraftUtil.metal.size() - 1) values = 0; + if (values > JewelrycraftUtil.metal.size() - 1) values = 0; JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values).copy()); text = "These buckets contain molten metal. To obtain one simply Right Click a full Smelter to get a bucket. You can pour the metal, other than that it has no use. You can place the molten metal back in a Smelter by Right Clicking one with it."; Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop() - 5, item, text, 40f, 0, 0, true, 45, 10); @@ -197,28 +130,37 @@ public class GuiTabItems extends GuiTab } } + /** + * @return + */ + @Override public int getMaxPages() { return 15; } + /** + * @param gui + * @param x + * @param y + * @param button + */ + @Override public void mouseClick(GuiGuide gui, int x, int y, int button) { - if (gui.page == 13 && x >= gui.getLeft() && x <= gui.getLeft() + 30 && y >= gui.getTop() + 104 && y <= gui.getTop() + 124) - { - try - { - Desktop.getDesktop().browse(new URL("http://www.minecraftforum.net/topic/2210959-164smp-ssp-jewelrycraft-version-12/").toURI()); - } - catch (Exception e) - { - } + if (gui.page == 13 && x >= gui.getLeft() && x <= gui.getLeft() + 30 && y >= gui.getTop() + 104 && y <= gui.getTop() + 124) try{ + Desktop.getDesktop().browse(new URL("http://www.minecraftforum.net/topic/2210959-164smp-ssp-jewelrycraft-version-12/").toURI()); } + catch(Exception e){} } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawForeground(GuiGuide gui, int x, int y, int page) - { - } - + {} } diff --git a/java/darkknight/jewelrycraft/container/GuiTabModifiers.java b/java/darkknight/jewelrycraft/container/GuiTabModifiers.java index 6a0143d..b7d4d1b 100644 --- a/java/darkknight/jewelrycraft/container/GuiTabModifiers.java +++ b/java/darkknight/jewelrycraft/container/GuiTabModifiers.java @@ -1,50 +1,71 @@ package darkknight.jewelrycraft.container; -import java.util.ArrayList; - -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import darkknight.jewelrycraft.block.BlockList; import darkknight.jewelrycraft.client.GuiGuide; -import darkknight.jewelrycraft.item.ItemList; public class GuiTabModifiers extends GuiTab -{ +{ + + /** + * @param id + */ public GuiTabModifiers(int id) { super("Modifiers", id); } + /** + * @return + */ + @Override public ItemStack getIcon() { return new ItemStack(Items.blaze_powder); } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawBackground(GuiGuide gui, int x, int y, int page) { String text = ""; - int xPos = (page % 2 == 0) ? 107 : -35; - switch (page) + int xPos = page % 2 == 0 ? 107 : -35; + switch(page) { case 1: - text = "This is a test to see if the program works or not! And it does seem to be working. Yaaay! Thank God I made this. This is so much easier :D"; + text = "Although you can add anything as a modifier, only some objects have an effect. In this tab you can find all of modifiers that have a use and what they do, in the form of a story/riddle/poem. However different jewellery have different effects for the same modifier."; + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 2: + text = "The ancient ones talked about a rising fire in your heart. Fret do not, for flames do not burn, but water might sting a turn. Watch your step, do not be cocky, for its protection is a bit sloppy."; Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(Items.blaze_powder), text, 40f); break; - default:; + default: + ; } } + /** + * @return + */ + @Override public int getMaxPages() { return 1; } + /** + * @param gui + * @param x + * @param y + * @param page + */ @Override public void drawForeground(GuiGuide gui, int x, int y, int page) - { - } - + {} } diff --git a/java/darkknight/jewelrycraft/container/JewelryInventory.java b/java/darkknight/jewelrycraft/container/JewelryInventory.java index 05accfa..ce6f0b5 100644 --- a/java/darkknight/jewelrycraft/container/JewelryInventory.java +++ b/java/darkknight/jewelrycraft/container/JewelryInventory.java @@ -4,47 +4,67 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import darkknight.jewelrycraft.item.ItemBracelet; +import darkknight.jewelrycraft.item.ItemEarrings; +import darkknight.jewelrycraft.item.ItemNecklace; +import darkknight.jewelrycraft.item.ItemRing; +import darkknight.jewelrycraft.util.PlayerUtils; public class JewelryInventory implements IInventory { - public ItemStack[] inventory = new ItemStack[18]; - public JewelryInventory() + public EntityPlayer player; + public ItemStack[] inventory = new ItemStack[18]; + + /** + * @param player + */ + public JewelryInventory(EntityPlayer player) { + this.player = player; + NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft"); + for(int i = 0; i < 18; i++) + inventory[i] = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("ext" + i)); } + /** + * @return + */ @Override public int getSizeInventory() { return inventory.length; } + /** + * @param slot + * @return + */ @Override public ItemStack getStackInSlot(int slot) { return inventory[slot]; } + /** + * @param slot + * @param amount + * @return + */ @Override public ItemStack decrStackSize(int slot, int amount) { ItemStack stack = getStackInSlot(slot); - if (stack != null) - { - if (stack.stackSize > amount) - { - stack = stack.splitStack(amount); - markDirty(); - } - else - { - setInventorySlotContents(slot, null); - } - } - + if (stack != null) if (stack.stackSize > amount){ + stack = stack.splitStack(amount); + markDirty(); + }else setInventorySlotContents(slot, null); return stack; } + /** + * @param slot + * @return + */ @Override public ItemStack getStackInSlotOnClosing(int slot) { @@ -53,66 +73,93 @@ public class JewelryInventory implements IInventory return stack; } + /** + * @param slot + * @param stack + */ @Override public void setInventorySlotContents(int slot, ItemStack stack) { inventory[slot] = stack; - if (stack != null && stack.stackSize > getInventoryStackLimit()) - { - stack.stackSize = getInventoryStackLimit(); - } + if (stack != null && stack.stackSize > getInventoryStackLimit()) stack.stackSize = getInventoryStackLimit(); markDirty(); } + /** + * @return + */ @Override public String getInventoryName() { return "Jewelry"; } + /** + * @return + */ @Override public boolean hasCustomInventoryName() { return false; } + /** + * @return + */ @Override public int getInventoryStackLimit() { return 1; } + /** + * + */ @Override public void markDirty() { - for (int i = 0; i < getSizeInventory(); ++i) - { - if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) - { - inventory[i] = null; - } - } + NBTTagCompound nbt = PlayerUtils.getModPlayerPersistTag(player, "Jewelrycraft"); + for(int i = 0; i < 18; i++) + if (inventory[i] != null) nbt.setTag("ext" + i, inventory[i].writeToNBT(nbt.getCompoundTag("ext" + i))); + else nbt.removeTag("ext" + i); } + /** + * @param player + * @return + */ @Override public boolean isUseableByPlayer(EntityPlayer player) { return true; } + /** + * + */ @Override public void openInventory() - { - } + {} + /** + * + */ @Override public void closeInventory() - { - } + {} + /** + * @param slot + * @param stack + * @return + */ @Override public boolean isItemValidForSlot(int slot, ItemStack stack) { - return true; + if (slot >= 0 && slot <= 9 && stack.getItem() instanceof ItemRing) return true; + else if (slot >= 10 && slot <= 13 && stack.getItem() instanceof ItemBracelet) return true; + else if (slot >= 14 && slot <= 16 && stack.getItem() instanceof ItemNecklace) return true; + else if (slot == 17 && stack.getItem() instanceof ItemEarrings) return true; + return false; } } \ No newline at end of file diff --git a/java/darkknight/jewelrycraft/container/Page.java b/java/darkknight/jewelrycraft/container/Page.java index 69de204..bca21a8 100644 --- a/java/darkknight/jewelrycraft/container/Page.java +++ b/java/darkknight/jewelrycraft/container/Page.java @@ -1,174 +1,106 @@ package darkknight.jewelrycraft.container; import java.util.ArrayList; -import java.util.List; - import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; - import org.lwjgl.opengl.GL11; - import darkknight.jewelrycraft.client.GuiGuide; public class Page { - public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, ArrayList items, int mouseX, int mouseY) + static ResourceLocation pageFlipped = new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png"); + + /** + * @param gui + * @param x + * @param y + * @param isSmall + * @param text + * @param mouseX + * @param mouseY + * @param items + */ + public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, String text, int mouseX, int mouseY, ItemStack ... items) { y += 5; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(0).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName()) / 2) - 10, y - 2, 0); + gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[0].getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items[0].getDisplayName()) / 2) - 10, y - 2, 0); GL11.glColor4f(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip.png")); + Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped); ArrayList name = new ArrayList(); - if (isSmall) - { + if (isSmall){ gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46); - gui.renderItem(items.get(0), x + 89, y + 22 + 10, 30f); - // gui.drawRect(x, y + 10, x + 111, y + 46, 325325); - if (items.size() > 1 && items.get(1) != null) - { - gui.renderItem(items.get(1), x + 8, y + 16 + 10, 30f); - List list = new ArrayList(); - list.add(text); - if (x - gui.getLeft() >= x + 8) gui.drawHoverString(list, x, y); - name.add(items.get(1).getDisplayName()); - if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x - 8, y + 10); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 2 && items.get(2) != null) - { - gui.renderItem(items.get(2), x + 30, y + 16 + 10, 30f); - name.add(items.get(2).getDisplayName()); - if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 15, y + 10); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 3 && items.get(3) != null) - { - gui.renderItem(items.get(3), x + 8, y + 40 + 10, 30f); - name.add(items.get(3).getDisplayName()); - if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x - 8, y + 35); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 4 && items.get(4) != null) - { - gui.renderItem(items.get(4), x + 30, y + 40 + 10, 30f); - name.add(items.get(4).getDisplayName()); - if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x + 15, y + 35); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } + gui.renderItem(items[0], x + 89, y + 22 + 10, 30f); + for(int i = 1; i <= 4; i++) + if (items.length > i && items[i] != null){ + int posX = x + 8 + (i - 1) % 2 * 22; + int posY = y + 26 + (i - 1) / 2 * 22; + gui.renderItem(items[i], posX, posY, 30f); + name.add(items[i].getDisplayName()); + if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 16 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 14); + name.removeAll(name); + GL11.glDisable(GL11.GL_LIGHTING); + } drawText(gui, text, x, y + 25); - } - else - { + }else{ gui.drawTexturedModalRect(x, y + 12, 145, 0, 111, 54); - gui.renderItem(items.get(0), x + 91, y + 28 + 10, 30f); - if (items.size() > 1 && items.get(1) != null) - { - gui.renderItem(items.get(1), x + 8, y + 20, 30f); - name.add(items.get(1).getDisplayName()); - if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 8, y + 10); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 2 && items.get(2) != null) - { - gui.renderItem(items.get(2), x + 28, y + 20, 30f); - name.add(items.get(2).getDisplayName()); - if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 28, y + 10); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 3 && items.get(3) != null) - { - gui.renderItem(items.get(3), x + 45, y + 20, 30f); - name.add(items.get(3).getDisplayName()); - if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 45, y + 10); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 4 && items.get(4) != null) - { - gui.renderItem(items.get(4), x + 8, y + 37, 30f); - name.add(items.get(4).getDisplayName()); - if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 8, y + 27); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 5 && items.get(5) != null) - { - gui.renderItem(items.get(5), x + 28, y + 37, 30f); - name.add(items.get(5).getDisplayName()); - if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 28, y + 27); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 6 && items.get(6) != null) - { - gui.renderItem(items.get(6), x + 45, y + 37, 30f); - name.add(items.get(6).getDisplayName()); - if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 45, y + 27); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 7 && items.get(7) != null) - { - gui.renderItem(items.get(7), x + 8, y + 54, 30f); - name.add(items.get(7).getDisplayName()); - if (mouseX >= x && mouseX <= x + 16 && mouseY >= y + 44 && mouseY <= y + 44 + 16) gui.drawHoverString(name, x + 8, y + 44); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 8 && items.get(8) != null) - { - gui.renderItem(items.get(8), x + 28, y + 54, 30f); - name.add(items.get(8).getDisplayName()); - if (mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 44 && mouseY <= y + 44 + 16) gui.drawHoverString(name, x + 28, y + 44); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } - if (items.size() > 9 && items.get(9) != null) - { - gui.renderItem(items.get(9), x + 45, y + 54, 30f); - name.add(items.get(9).getDisplayName()); - if (mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 44 && mouseY <= y + 44 + 16) gui.drawHoverString(name, x + 45, y + 44); - name.removeAll(name); - GL11.glDisable(GL11.GL_LIGHTING); - } + gui.renderItem(items[0], x + 91, y + 28 + 10, 30f); + for(int i = 1; i <= 9; i++) + if (items.length > i && items[i] != null){ + int posX = x + 8 + (i - 1) % 3 * 19; + int posY = y + 22 + (i - 1) / 3 * 17; + gui.renderItem(items[i], posX, posY, 30f); + name.add(items[i].getDisplayName()); + if (mouseX >= posX - 8 && mouseX <= posX + 8 && mouseY >= posY - 10 && mouseY <= posY) gui.drawHoverString(name, posX - 20, posY - 12); + name.removeAll(name); + GL11.glDisable(GL11.GL_LIGHTING); + } drawText(gui, text, x, y + 32); GL11.glColor4f(1, 1, 1, 1); } GL11.glDisable(GL11.GL_BLEND); } - public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, ArrayList items, int mouseX, int mouseY) + /** + * @param gui + * @param x + * @param y + * @param text + * @param mouseX + * @param mouseY + * @param items + */ + public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, String text, int mouseX, int mouseY, ItemStack ... items) { ArrayList name = new ArrayList(); - gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items.get(1).getDisplayName(), x + 30 - items.get(0).getDisplayName().length() / 2, y + 2, 0); + gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + items[1].getDisplayName(), x + 30 - items[0].getDisplayName().length() / 2, y + 2, 0); GL11.glColor4f(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip" + ".png")); + Minecraft.getMinecraft().getTextureManager().bindTexture(pageFlipped); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 56); - - gui.renderItem(items.get(0), x + 13, y + 20 + 10, 35f); - name.add(items.get(0).getDisplayName()); + gui.renderItem(items[0], x + 13, y + 20 + 10, 35f); + name.add(items[0].getDisplayName()); if (mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20); name.removeAll(name); GL11.glDisable(GL11.GL_LIGHTING); - - gui.renderItem(items.get(1), x + 77, y + 28 + 10, 35f); + gui.renderItem(items[1], x + 77, y + 28 + 10, 35f); drawText(gui, text, x, y + 30); GL11.glColor4f(1, 1, 1, 1); GL11.glDisable(GL11.GL_BLEND); } + /** + * @param gui + * @param x + * @param y + * @param item + * @param text + * @param size + */ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size) { y += 5; @@ -177,10 +109,23 @@ public class Page gui.getFont().drawString(EnumChatFormatting.DARK_BLUE + "\u00a7n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName()) / 2) - 10, y + 2, 0); GL11.glColor4f(1, 1, 1, 1); gui.renderItem(item, x + 13, y + 18, size); - drawText(gui, text, x, y); + drawText(gui, text, x, y - (int)(200 / size)); GL11.glDisable(GL11.GL_BLEND); } + /** + * @param gui + * @param x + * @param y + * @param item + * @param text + * @param size + * @param txtX + * @param txtY + * @param showName + * @param imgX + * @param imgY + */ public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, String text, float size, int txtX, int txtY, boolean showName, int imgX, int imgY) { y += 5; @@ -193,6 +138,12 @@ public class Page GL11.glDisable(GL11.GL_BLEND); } + /** + * @param gui + * @param x + * @param y + * @param text + */ public static void addTextPage(GuiGuide gui, int x, int y, String text) { y -= 25; @@ -200,22 +151,25 @@ public class Page GL11.glColor4f(1, 1, 1, 1); } + /** + * @param gui + * @param text + * @param x + * @param y + */ public static void drawText(GuiGuide gui, String text, int x, int y) { String[] s = text.split(" "); String displayText = ""; ArrayList textLines = new ArrayList(); - for (int i = 0; i < s.length; i++) - { - if ((displayText + s[i] + " ").length() <= 24) displayText += s[i] + " "; - else - { + for(String element: s) + if ((displayText + element + " ").length() <= 24) displayText += element + " "; + else{ textLines.add(displayText.trim()); - displayText = s[i] + " "; + displayText = element + " "; } - } textLines.add(displayText.trim()); - for (int i = 0; i < textLines.size(); i++) + for(int i = 0; i < textLines.size(); i++) gui.getFont().drawString(textLines.get(i), x, y + 30 + i * 12, 0); } } diff --git a/java/darkknight/jewelrycraft/container/SlotBracelet.java b/java/darkknight/jewelrycraft/container/SlotBracelet.java new file mode 100644 index 0000000..c82421d --- /dev/null +++ b/java/darkknight/jewelrycraft/container/SlotBracelet.java @@ -0,0 +1,52 @@ +package darkknight.jewelrycraft.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.item.ItemBracelet; + +public class SlotBracelet extends Slot +{ + + /** + * @param tile + * @param slotID + * @param x + * @param y + */ + public SlotBracelet(IInventory tile, int slotID, int x, int y) + { + super(tile, slotID, x, y); + } + + /** + * @param stack + * @return + */ + @Override + public boolean isItemValid(ItemStack stack) + { + return stack.getItem() instanceof ItemBracelet; + } + + /** + * @param amount + * @return + */ + @Override + public ItemStack decrStackSize(int amount) + { + return super.decrStackSize(amount); + } + + /** + * @param player + * @return + */ + @Override + public boolean canTakeStack(EntityPlayer player) + { + return true; + } +} diff --git a/java/darkknight/jewelrycraft/container/SlotEarrings.java b/java/darkknight/jewelrycraft/container/SlotEarrings.java new file mode 100644 index 0000000..550f4f9 --- /dev/null +++ b/java/darkknight/jewelrycraft/container/SlotEarrings.java @@ -0,0 +1,52 @@ +package darkknight.jewelrycraft.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.item.ItemEarrings; + +public class SlotEarrings extends Slot +{ + + /** + * @param tile + * @param slotID + * @param x + * @param y + */ + public SlotEarrings(IInventory tile, int slotID, int x, int y) + { + super(tile, slotID, x, y); + } + + /** + * @param stack + * @return + */ + @Override + public boolean isItemValid(ItemStack stack) + { + return stack.getItem() instanceof ItemEarrings; + } + + /** + * @param amount + * @return + */ + @Override + public ItemStack decrStackSize(int amount) + { + return super.decrStackSize(amount); + } + + /** + * @param player + * @return + */ + @Override + public boolean canTakeStack(EntityPlayer player) + { + return true; + } +} diff --git a/java/darkknight/jewelrycraft/container/SlotNecklace.java b/java/darkknight/jewelrycraft/container/SlotNecklace.java new file mode 100644 index 0000000..42543b0 --- /dev/null +++ b/java/darkknight/jewelrycraft/container/SlotNecklace.java @@ -0,0 +1,52 @@ +package darkknight.jewelrycraft.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.item.ItemNecklace; + +public class SlotNecklace extends Slot +{ + + /** + * @param tile + * @param slotID + * @param x + * @param y + */ + public SlotNecklace(IInventory tile, int slotID, int x, int y) + { + super(tile, slotID, x, y); + } + + /** + * @param stack + * @return + */ + @Override + public boolean isItemValid(ItemStack stack) + { + return stack.getItem() instanceof ItemNecklace; + } + + /** + * @param amount + * @return + */ + @Override + public ItemStack decrStackSize(int amount) + { + return super.decrStackSize(amount); + } + + /** + * @param player + * @return + */ + @Override + public boolean canTakeStack(EntityPlayer player) + { + return true; + } +} diff --git a/java/darkknight/jewelrycraft/container/SlotRing.java b/java/darkknight/jewelrycraft/container/SlotRing.java index 3207301..52aa4fb 100644 --- a/java/darkknight/jewelrycraft/container/SlotRing.java +++ b/java/darkknight/jewelrycraft/container/SlotRing.java @@ -8,23 +8,42 @@ import darkknight.jewelrycraft.item.ItemRing; public class SlotRing extends Slot { + + /** + * @param tile + * @param slotID + * @param x + * @param y + */ public SlotRing(IInventory tile, int slotID, int x, int y) { super(tile, slotID, x, y); } + /** + * @param stack + * @return + */ @Override public boolean isItemValid(ItemStack stack) { return stack.getItem() instanceof ItemRing; } + /** + * @param amount + * @return + */ @Override public ItemStack decrStackSize(int amount) { return super.decrStackSize(amount); } + /** + * @param player + * @return + */ @Override public boolean canTakeStack(EntityPlayer player) { diff --git a/java/darkknight/jewelrycraft/container/SlotRingChest.java b/java/darkknight/jewelrycraft/container/SlotRingChest.java index fe4cdd0..b1f553c 100644 --- a/java/darkknight/jewelrycraft/container/SlotRingChest.java +++ b/java/darkknight/jewelrycraft/container/SlotRingChest.java @@ -9,25 +9,44 @@ public class SlotRingChest extends Slot { public boolean locked = false; + /** + * @param tile + * @param slotID + * @param x + * @param y + * @param locked + */ public SlotRingChest(IInventory tile, int slotID, int x, int y, boolean locked) { super(tile, slotID, x, y); this.locked = locked; } + /** + * @param stack + * @return + */ @Override public boolean isItemValid(ItemStack stack) { return !locked; } + /** + * @param amount + * @return + */ @Override public ItemStack decrStackSize(int amount) { - if (!locked) { return super.decrStackSize(amount); } + if (!locked) return super.decrStackSize(amount); return null; } + /** + * @param player + * @return + */ @Override public boolean canTakeStack(EntityPlayer player) { -- cgit v1.2.3