Merge pull request #1058 from Georggi/patch-4

Auto Maintenance Hatch tweaks
This commit is contained in:
Blood-Asp 2017-05-31 18:57:39 +02:00 committed by GitHub
commit 3f73fa9b86
3 changed files with 12 additions and 4 deletions

View file

@ -258,6 +258,7 @@ public class GT_Mod implements IGT_Mod {
Calendar now = Calendar.getInstance(); Calendar now = Calendar.getInstance();
gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get(ConfigCategories.general, "AprilFool", now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) == 1); gregtechproxy.mAprilFool = GregTech_API.sSpecialFile.get(ConfigCategories.general, "AprilFool", now.get(Calendar.MONTH) == Calendar.APRIL && now.get(Calendar.DAY_OF_MONTH) == 1);
gregtechproxy.mCropNeedBlock = tMainConfig.get("general", "CropNeedBlockBelow", true).getBoolean(true); gregtechproxy.mCropNeedBlock = tMainConfig.get("general", "CropNeedBlockBelow", true).getBoolean(true);
gregtechproxy.mAMHInteraction = tMainConfig.get("general", "AllowAutoMaintenanceHatchInteraction", true).getBoolean(true);
GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true); GregTech_API.mOutputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "OutputRF", true);
GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false); GregTech_API.mInputRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "InputRF", false);
GregTech_API.mEUtoRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "100EUtoRF", 360); GregTech_API.mEUtoRF = GregTech_API.sOPStuff.get(ConfigCategories.general, "100EUtoRF", 360);

View file

@ -23,8 +23,8 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import scala.actors.threadpool.Arrays;
import java.util.Arrays;
import java.util.List; import java.util.List;
public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { 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 @Override
public boolean isValidSlot(int aIndex) { public boolean isValidSlot(int aIndex) {
return false; return mAuto && GT_Mod.gregtechproxy.mAMHInteraction;
} }
@Override @Override
@ -128,6 +128,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity); 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() { public boolean autoMaintainance() {
boolean tSuccess = true; 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)}; 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.mSoftHammer = true;
this.mSolderingTool = true; this.mSolderingTool = true;
this.mWrench = true; this.mWrench = true;
updateSlots();
return true; return true;
} }
return false; return false;
@ -208,11 +214,11 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
@Override @Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false; return mAuto && GT_Mod.gregtechproxy.mAMHInteraction;
} }
@Override @Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false; return mAuto && GT_Mod.gregtechproxy.mAMHInteraction;
} }
} }

View file

@ -196,6 +196,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
public boolean mLowGravProcessing = false; public boolean mLowGravProcessing = false;
public boolean mAprilFool = false; public boolean mAprilFool = false;
public boolean mCropNeedBlock = true; public boolean mCropNeedBlock = true;
public boolean mAMHInteraction = true;
public GT_Proxy() { public GT_Proxy() {
GameRegistry.registerFuelHandler(this); GameRegistry.registerFuelHandler(this);