diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2018-05-17 08:40:56 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2018-05-17 08:40:56 +1000 |
commit | 23adeefa94f8f6f67bafacd1969bf0b07328b609 (patch) | |
tree | 26e7fb7e8fb9f7a3d4d1d348f058d25f53f33ea1 /src/Java/gtPlusPlus/core/slots/SlotLockedInput.java | |
parent | 92494e56c33fc029f6b06be1c76e50bb5be56cbe (diff) | |
download | GT5-Unofficial-23adeefa94f8f6f67bafacd1969bf0b07328b609.tar.gz GT5-Unofficial-23adeefa94f8f6f67bafacd1969bf0b07328b609.tar.bz2 GT5-Unofficial-23adeefa94f8f6f67bafacd1969bf0b07328b609.zip |
+ Added some new Fusion Reactor Casings & Coils.
+ Added recipes for the shelves.
% Made the Adv. EBF process 8 parallel recipes, up from 4.
% Made the Fusion Reaction MK IV use the new casings.
Diffstat (limited to 'src/Java/gtPlusPlus/core/slots/SlotLockedInput.java')
-rw-r--r-- | src/Java/gtPlusPlus/core/slots/SlotLockedInput.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/slots/SlotLockedInput.java b/src/Java/gtPlusPlus/core/slots/SlotLockedInput.java new file mode 100644 index 0000000000..c67f8acfeb --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotLockedInput.java @@ -0,0 +1,57 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredChest; + +public class SlotLockedInput extends Slot { + + private ItemStack mLockStack; + private final IGregTechTileEntity mEntity; + private boolean mChecked = false; + + public SlotLockedInput(final IGregTechTileEntity inventory, final int index, final int x, final int y, ItemStack lockStack) { + super(inventory, index, x, y); + mLockStack = lockStack; + mEntity = inventory; + } + + @Override + public boolean isItemValid(final ItemStack itemstack) { + if (mEntity == null) { + return false; + } + else { + if (!mChecked) { + try { + mLockStack = (ItemStack) ReflectionUtils.getField(this.mEntity.getMetaTileEntity().getClass(), "mItemStack").get(this.mEntity.getMetaTileEntity()); + } + catch (Throwable t) { + t.printStackTrace(); + mLockStack = null; + } + mChecked = true; + } + } + + if (mLockStack == null) { + return true; + } + else { + if (ItemStack.areItemStacksEqual(itemstack, mLockStack)) { + return true; + } + } + return false; + } + + @Override + public int getSlotStackLimit() { + return mLockStack == null ? 64 : mLockStack.getMaxStackSize(); + } + +} |