From 6312636fd9a4d0f56dc7c9ff474a99d879bcb4e9 Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Mon, 23 Mar 2015 14:51:06 +0000 Subject: Reworked the whole repo. --- .../jewelrycraft/container/SlotRingChest.java | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java (limited to 'src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java') diff --git a/src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java b/src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java new file mode 100644 index 0000000..b1f553c --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java @@ -0,0 +1,55 @@ +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; + +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); + return null; + } + + /** + * @param player + * @return + */ + @Override + public boolean canTakeStack(EntityPlayer player) + { + return !locked; + } +} -- cgit v1.2.3