From 5c2b131a29c3ea0871ecbd400635ca0be3ebdfbe Mon Sep 17 00:00:00 2001 From: Alkalus Date: Wed, 15 Nov 2017 03:25:34 +1000 Subject: $ Fixed Power Sub-Station not providing very good scanner info. + Added stats for nerds to the PSS. + Added custom (dis)charge hatches for use with the PSS. --- src/Java/gtPlusPlus/core/slots/SlotElectric.java | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Java/gtPlusPlus/core/slots/SlotElectric.java (limited to 'src/Java/gtPlusPlus/core/slots') diff --git a/src/Java/gtPlusPlus/core/slots/SlotElectric.java b/src/Java/gtPlusPlus/core/slots/SlotElectric.java new file mode 100644 index 0000000000..6b11cf5264 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotElectric.java @@ -0,0 +1,43 @@ +package gtPlusPlus.core.slots; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.items.GT_MetaGenerated_Tool; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotElectric extends Slot { + + public SlotElectric(final IInventory inventory, final int x, final int y, final int z) { + super(inventory, x, y, z); + } + + public SlotElectric(IGregTechTileEntity mTileEntity, int i, int j, int k) { + this(mTileEntity.getIInventory(mTileEntity.getXCoord(), mTileEntity.getYCoord(), mTileEntity.getZCoord()), i, j, k); + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + if ((accepts(itemstack)) || (itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof IElectricItem)) { + return true; + } + return false; + } + + public boolean accepts(final ItemStack stack) { + if (stack == null) { + return false; + } + return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) + || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), 4, true, true, true) > 0.0D); + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} -- cgit