diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/slots')
-rw-r--r-- | src/Java/gtPlusPlus/core/slots/SlotFrame.java | 25 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java | 28 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/slots/SlotRTG.java | 25 |
3 files changed, 78 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/slots/SlotFrame.java b/src/Java/gtPlusPlus/core/slots/SlotFrame.java new file mode 100644 index 0000000000..13bc8fa717 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotFrame.java @@ -0,0 +1,25 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import forestry.api.apiculture.IHiveFrame; + +public class SlotFrame extends Slot{ + + public SlotFrame(IInventory inventory, int x, int y, int z) { + super(inventory, x, y, z); + + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + return itemstack.getItem() instanceof IHiveFrame; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java new file mode 100644 index 0000000000..7a22086949 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotItemBackpackInv.java @@ -0,0 +1,28 @@ +package gtPlusPlus.core.slots; + +import gtPlusPlus.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 diff --git a/src/Java/gtPlusPlus/core/slots/SlotRTG.java b/src/Java/gtPlusPlus/core/slots/SlotRTG.java new file mode 100644 index 0000000000..1f16463de2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotRTG.java @@ -0,0 +1,25 @@ +package gtPlusPlus.core.slots; + +import ic2.core.Ic2Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotRTG extends Slot{ + + public SlotRTG(IInventory inventory, int x, int y, int z) { + super(inventory, x, y, z); + + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + return itemstack.getItem().getClass() == Ic2Items.RTGPellets.getItem().getClass(); + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} |