From b0ae00d54790023197a7df31199cdbfd3e54ec10 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Mon, 29 Aug 2016 18:33:37 +1000 Subject: + Added Custom Backpacks. - Removed some old blocks which were statically generated. They still exist, now just are created using the dynamic block creation system. --- .../miscutil/core/slots/SlotItemBackpackInv.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Java/miscutil/core/slots/SlotItemBackpackInv.java (limited to 'src/Java/miscutil/core/slots') diff --git a/src/Java/miscutil/core/slots/SlotItemBackpackInv.java b/src/Java/miscutil/core/slots/SlotItemBackpackInv.java new file mode 100644 index 0000000000..534230ba59 --- /dev/null +++ b/src/Java/miscutil/core/slots/SlotItemBackpackInv.java @@ -0,0 +1,28 @@ +package miscutil.core.slots; + +import miscutil.core.item.base.BaseItemBackpack; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotItemBackpackInv extends Slot +{ + public SlotItemBackpackInv(IInventory inv, int index, int xPos, int yPos) + { + super(inv, index, xPos, yPos); + } + + // This is the only method we need to override so that + // we can't place our inventory-storing Item within + // its own inventory (thus making it permanently inaccessible) + // as well as preventing abuse of storing backpacks within backpacks + /** + * Check if the stack is a valid item for this slot. + */ + @Override + public boolean isItemValid(ItemStack itemstack) + { + // Everything returns true except an instance of our Item + return !(itemstack.getItem() instanceof BaseItemBackpack); + } +} \ No newline at end of file -- cgit