From 4e3ed071dc118de59128ffb03356377c3152e5a8 Mon Sep 17 00:00:00 2001 From: Yura Date: Tue, 16 May 2017 16:17:01 +0300 Subject: [PATCH] Auto Maintenance Hatch tweaks Fixed #958 and #1053, allowed robots\pipes to interact with it. --- .../GT_MetaTileEntity_Hatch_Maintenance.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index 3bcd29a6..eb9b6954 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -23,8 +23,8 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import scala.actors.threadpool.Arrays; +import java.util.Arrays; import java.util.List; public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { @@ -99,7 +99,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public boolean isValidSlot(int aIndex) { - return false; + return mAuto; } @Override @@ -128,6 +128,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity); } + public void updateSlots() { + for (int i = 0; i < mInventory.length; i++) + if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null; + } + public boolean autoMaintainance() { boolean tSuccess = true; ItemStack[] mInputs = new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)}; @@ -174,6 +179,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch this.mSoftHammer = true; this.mSolderingTool = true; this.mWrench = true; + updateSlots() return true; } return false; @@ -208,11 +214,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; + return mAuto; } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return false; + return mAuto; } }