From 01c8701b68986ccfa83e902515716838d6829311 Mon Sep 17 00:00:00 2001 From: Onyx Date: Tue, 1 Dec 2015 20:55:30 +0000 Subject: - Fixed all of the bugs mentioned on github - Added new config options - Rabbits paw now increases the chance of spawning hearts, rather than itself spawning some - Hearts now have a much lower chance to spawn by default - You can no longer increase your health past 20 hearts (aka double the default health) - The guide now also shows the total number of pages on each tab - A new luck stat has been added to the Curse API - Cleaned up the code a bit (removed unused methods, imports etc) - The displayer's info now has a purple solid color background; the text also has a much closer shadow and now shrinks in height as well as in width when too big - I have modified the potion list to use Mithion's code, credits have been given --- .../gui/container/ContainerJewelryModifier.java | 97 +++++----- .../client/gui/container/ContainerJewelryTab.java | 210 +++++++++++---------- .../client/gui/container/slots/SlotBracelet.java | 106 +++++------ .../client/gui/container/slots/SlotEarrings.java | 106 +++++------ .../client/gui/container/slots/SlotNecklace.java | 106 +++++------ .../client/gui/container/slots/SlotRing.java | 106 +++++------ 6 files changed, 373 insertions(+), 358 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/client/gui/container') diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java index afb32d7..e749506 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java @@ -1,50 +1,47 @@ -package darkknight.jewelrycraft.client.gui.container; - -import net.minecraft.client.gui.GuiButton; -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.client.gui.container.slots.SlotRing; - -public class ContainerJewelryModifier extends Container -{ - public IInventory modInv; - public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod) - { - int x, y; - modInv = mod; - for(x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225)); - for(y = 0; y < 3; y++) - for(x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + y * 9, 26 + 18 * x, 167 + y * 18)); - addSlotToContainer(new Slot(mod, 36, 37, 9)); - } - - @Override - public boolean canInteractWith(EntityPlayer player) - { - return true; - } - - @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) - { - ItemStack itemstack = null; - Slot slot = (Slot)inventorySlots.get(par2); - if (slot != null && slot.getHasStack()){ - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - 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; - } -} +package darkknight.jewelrycraft.client.gui.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; + +public class ContainerJewelryModifier extends Container +{ + public IInventory modInv; + public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod) + { + int x, y; + modInv = mod; + for(x = 0; x < 9; x++) + addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225)); + for(y = 0; y < 3; y++) + for(x = 0; x < 9; x++) + addSlotToContainer(new Slot(inv, x + 9 + y * 9, 26 + 18 * x, 167 + y * 18)); + addSlotToContainer(new Slot(mod, 36, 37, 9)); + } + + @Override + public boolean canInteractWith(EntityPlayer player) + { + return true; + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack itemstack = null; + Slot slot = (Slot)inventorySlots.get(par2); + if (slot != null && slot.getHasStack()){ + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + 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/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java index 634782c..dd12540 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java @@ -1,96 +1,114 @@ -package darkknight.jewelrycraft.client.gui.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import darkknight.jewelrycraft.api.IJewelryItem; -import darkknight.jewelrycraft.client.gui.container.slots.SlotBracelet; -import darkknight.jewelrycraft.client.gui.container.slots.SlotEarrings; -import darkknight.jewelrycraft.client.gui.container.slots.SlotNecklace; -import darkknight.jewelrycraft.client.gui.container.slots.SlotRing; -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 -{ - /** - * @param player - * @param inv - * @param extra - */ - public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra) - { - int x, y; - // Rings - 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) - addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142)); - // Inventory - 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 player, int slotID) - { - ItemStack itemstack = null; - Slot slot = (Slot)inventorySlots.get(slotID); - if (slot != null && slot.getHasStack()){ - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - if (slotID >= 18){ - if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 0)){ - if (!mergeItemStack(itemstack, 0, 10, false) && !slot.getHasStack()) return null; - }else if (itemstack.getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 1)){ - if (!mergeItemStack(itemstack, 10, 14, false) && !slot.getHasStack()) return null; - }else if (itemstack.getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 2)){ - if (!mergeItemStack(itemstack, 14, 17, false) && !slot.getHasStack()) return null; - }else if (itemstack.getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 3)){ - if (!mergeItemStack(itemstack, 17, 18, false) && !slot.getHasStack()) return null; - } - else{ - if (slotID < 27){ - if (!mergeItemStack(itemstack, 27, 36 + 18, false)) return null; - }else{ - if (!mergeItemStack(itemstack, 18, 27, false)) return null; - } - } - }else if (!mergeItemStack(itemstack, 18, inventorySlots.size(), false)) return null; - if (itemstack.stackSize == 0) slot.putStack(null); - else slot.onSlotChanged(); - if (itemstack.stackSize != itemstack.stackSize) slot.onPickupFromSlot(player, itemstack); - else return null; - } - return itemstack; - } -} +package darkknight.jewelrycraft.client.gui.container; + +import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.api.IJewelryItem; +import darkknight.jewelrycraft.client.gui.container.slots.SlotBracelet; +import darkknight.jewelrycraft.client.gui.container.slots.SlotEarrings; +import darkknight.jewelrycraft.client.gui.container.slots.SlotNecklace; +import darkknight.jewelrycraft.client.gui.container.slots.SlotRing; +import darkknight.jewelrycraft.item.ItemBaseJewelry; +import darkknight.jewelrycraft.item.ItemBracelet; +import darkknight.jewelrycraft.item.ItemEarrings; +import darkknight.jewelrycraft.item.ItemNecklace; +import darkknight.jewelrycraft.item.ItemRing; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerJewelryTab extends Container +{ + public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra) + { + int x, y; + // Rings + 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) + addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142)); + // Inventory + 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)); + } + + @Override + public boolean canInteractWith(EntityPlayer player) + { + return true; + } + + public ItemStack slotClick(int slotID, int j, int k, EntityPlayer player) + { + if (slotID >= 0 && slotID <= 17 && !player.worldObj.isRemote) { + try{ + if (player.inventory.getItemStack() == null && inventoryItemStacks.get(slotID) != null && ((ItemStack)inventoryItemStacks.get(slotID)).getItem() instanceof ItemBaseJewelry) + ((ItemBaseJewelry)((ItemStack)inventoryItemStacks.get(slotID)).getItem()).onJewelryUnequipped((ItemStack)inventoryItemStacks.get(slotID)); + else if (player.inventory.getItemStack() != null && player.inventory.getItemStack().getItem() instanceof ItemBaseJewelry && inventoryItemStacks.get(slotID) == null) + ((ItemBaseJewelry)player.inventory.getItemStack().getItem()).onJewelryEquipped(player.inventory.getItemStack()); + if (player.inventory.getItemStack() == null && inventoryItemStacks.get(slotID) != null && ((ItemStack)inventoryItemStacks.get(slotID)).getItem() instanceof IJewelryItem) + ((IJewelryItem)((ItemStack)inventoryItemStacks.get(slotID)).getItem()).onJewelryUnequipped((ItemStack)inventoryItemStacks.get(slotID)); + else if (player.inventory.getItemStack() != null && player.inventory.getItemStack().getItem() instanceof IJewelryItem && inventoryItemStacks.get(slotID) == null) + ((IJewelryItem)player.inventory.getItemStack().getItem()).onJewelryEquipped(player.inventory.getItemStack()); + } + catch(Exception e){ + JewelrycraftMod.logger.error("An error has occured while equipping an item."); + e.printStackTrace(); + } + } + return super.slotClick(slotID, j, k, player); + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int slotID) + { + ItemStack itemstack = null; + Slot slot = (Slot)inventorySlots.get(slotID); + if (slot != null && slot.getHasStack()) { + ItemStack itemstack1 = slot.getStack(); + itemstack = itemstack1.copy(); + if (slotID >= 18) { + if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 0)) { + if (!mergeItemStack(itemstack, 0, 10, false) && !slot.getHasStack()) + return null; + }else if (itemstack.getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 1)) { + if (!mergeItemStack(itemstack, 10, 14, false) && !slot.getHasStack()) + return null; + }else if (itemstack.getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 2)) { + if (!mergeItemStack(itemstack, 14, 17, false) && !slot.getHasStack()) + return null; + }else if (itemstack.getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem && ((IJewelryItem)itemstack.getItem()).type() == 3)) { + if (!mergeItemStack(itemstack, 17, 18, false) && !slot.getHasStack()) + return null; + }else{ + if (slotID < 27) { + if (!mergeItemStack(itemstack, 27, 36 + 18, false)) + return null; + }else{ + if (!mergeItemStack(itemstack, 18, 27, false)) + return null; + } + } + }else + if (!mergeItemStack(itemstack, 18, inventorySlots.size(), false)) + return null; + if (itemstack.stackSize == 0) + slot.putStack(null); + else slot.onSlotChanged(); + if (itemstack.stackSize != itemstack.stackSize) + slot.onPickupFromSlot(player, itemstack); + else return null; + } + return itemstack; + } +} diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java index bab265b..cfd2e20 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java @@ -1,53 +1,53 @@ -package darkknight.jewelrycraft.client.gui.container.slots; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import darkknight.jewelrycraft.api.IJewelryItem; -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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 1); - } - - /** - * @param amount - * @return - */ - @Override - public ItemStack decrStackSize(int amount) - { - return super.decrStackSize(amount); - } - - /** - * @param player - * @return - */ - @Override - public boolean canTakeStack(EntityPlayer player) - { - return true; - } -} +package darkknight.jewelrycraft.client.gui.container.slots; + +import darkknight.jewelrycraft.api.IJewelryItem; +import darkknight.jewelrycraft.item.ItemBracelet; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 1); + } + + /** + * @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/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java index c968fc0..e0603a3 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java @@ -1,53 +1,53 @@ -package darkknight.jewelrycraft.client.gui.container.slots; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import darkknight.jewelrycraft.api.IJewelryItem; -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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 3); - } - - /** - * @param amount - * @return - */ - @Override - public ItemStack decrStackSize(int amount) - { - return super.decrStackSize(amount); - } - - /** - * @param player - * @return - */ - @Override - public boolean canTakeStack(EntityPlayer player) - { - return true; - } -} +package darkknight.jewelrycraft.client.gui.container.slots; + +import darkknight.jewelrycraft.api.IJewelryItem; +import darkknight.jewelrycraft.item.ItemEarrings; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 3); + } + + /** + * @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/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java index d102ba8..4b810be 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java @@ -1,53 +1,53 @@ -package darkknight.jewelrycraft.client.gui.container.slots; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import darkknight.jewelrycraft.api.IJewelryItem; -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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 2); - } - - /** - * @param amount - * @return - */ - @Override - public ItemStack decrStackSize(int amount) - { - return super.decrStackSize(amount); - } - - /** - * @param player - * @return - */ - @Override - public boolean canTakeStack(EntityPlayer player) - { - return true; - } -} +package darkknight.jewelrycraft.client.gui.container.slots; + +import darkknight.jewelrycraft.api.IJewelryItem; +import darkknight.jewelrycraft.item.ItemNecklace; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 2); + } + + /** + * @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/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java index 6a7e956..4fb9265 100644 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java @@ -1,53 +1,53 @@ -package darkknight.jewelrycraft.client.gui.container.slots; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import darkknight.jewelrycraft.api.IJewelryItem; -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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 0); - } - - /** - * @param amount - * @return - */ - @Override - public ItemStack decrStackSize(int amount) - { - return super.decrStackSize(amount); - } - - /** - * @param player - * @return - */ - @Override - public boolean canTakeStack(EntityPlayer player) - { - return true; - } -} +package darkknight.jewelrycraft.client.gui.container.slots; + +import darkknight.jewelrycraft.api.IJewelryItem; +import darkknight.jewelrycraft.item.ItemRing; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +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 || (stack.getItem() instanceof IJewelryItem && ((IJewelryItem)stack.getItem()).type() == 0); + } + + /** + * @param amount + * @return + */ + @Override + public ItemStack decrStackSize(int amount) + { + return super.decrStackSize(amount); + } + + /** + * @param player + * @return + */ + @Override + public boolean canTakeStack(EntityPlayer player) + { + return true; + } +} -- cgit v1.2.3