diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-03-23 14:51:06 +0000 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-03-23 14:51:06 +0000 |
| commit | 6312636fd9a4d0f56dc7c9ff474a99d879bcb4e9 (patch) | |
| tree | e3279753210bfb169a00cd3f146a80baf624150e /src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java | |
| parent | e86949a1ad3269ec66c9de65e2c92f5e66251411 (diff) | |
Reworked the whole repo.
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/container/SlotRingChest.java | 55 |
1 files changed, 55 insertions, 0 deletions
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; + } +} |
