diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-29 18:33:37 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-08-29 18:33:37 +1000 |
commit | b0ae00d54790023197a7df31199cdbfd3e54ec10 (patch) | |
tree | e3e4bf0363c10c94dec3f5446f0ef4f5d8b9d9e2 /src/Java/miscutil/core/slots/SlotItemBackpackInv.java | |
parent | 059d00c29b765fd6b5937e9686dda3cd03af08e4 (diff) | |
download | GT5-Unofficial-b0ae00d54790023197a7df31199cdbfd3e54ec10.tar.gz GT5-Unofficial-b0ae00d54790023197a7df31199cdbfd3e54ec10.tar.bz2 GT5-Unofficial-b0ae00d54790023197a7df31199cdbfd3e54ec10.zip |
+ Added Custom Backpacks.
- Removed some old blocks which were statically generated. They still exist, now just are created using the dynamic block creation system.
Diffstat (limited to 'src/Java/miscutil/core/slots/SlotItemBackpackInv.java')
-rw-r--r-- | src/Java/miscutil/core/slots/SlotItemBackpackInv.java | 28 |
1 files changed, 28 insertions, 0 deletions
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 |