From b69f9b956c139fc1d6fd8ef787203da63695a82c Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 15 Feb 2019 20:29:58 +0000 Subject: % Adjusted documentation of MTE info within Transformer. $ Added more ASM to fix GT. MetaTileEntities can now be set in an invalid way without crashing the server/client. They now just invalidate and log to GT_LOG. $ Fixed a few NPE's thrown during startup by machines checking/creating invalid BlockPos. --- .../base/GregtechMeta_MultiBlockBase.java | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 2427815295..b55157e763 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -38,6 +38,8 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.GTplusplus.INIT_PHASE; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.BlockPos; @@ -904,10 +906,15 @@ GT_MetaTileEntity_MultiBlockBase { public boolean addToMachineListInternal(ArrayList aList, final IMetaTileEntity aTileEntity, - final int aBaseCasingIndex) { + final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } if (aList.isEmpty()) { if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { - log("Adding " + aTileEntity.getInventoryName() + " at " + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Adding " + aTileEntity.getInventoryName() + " at " + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString()); + } updateTexture(aTileEntity, aBaseCasingIndex); return aList.add((E) aTileEntity); } @@ -920,13 +927,17 @@ GT_MetaTileEntity_MultiBlockBase { BlockPos aPos = new BlockPos(b); if (b != null && aPos != null) { if (aCurPos.equals(aPos)) { - log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString()); + } return false; } } } if (aTileEntity instanceof GT_MetaTileEntity_Hatch) { - log("Adding " + aCur.getInventoryName() + " at " + aCurPos.getLocationString()); + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Adding " + aCur.getInventoryName() + " at " + aCurPos.getLocationString()); + } updateTexture(aTileEntity, aBaseCasingIndex); return aList.add((E) aTileEntity); } @@ -1607,7 +1618,9 @@ GT_MetaTileEntity_MultiBlockBase { } else if (aFoundBlock != aExpectedBlock) { log("A1 - Found: "+aFoundBlock.getLocalizedName()+":"+aFoundMeta+", Expected: "+aExpectedBlock.getLocalizedName()+":"+aExpectedMeta); - log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); + if (GTplusplus.CURRENT_LOAD_PHASE == INIT_PHASE.STARTED) { + log("Loc: "+(new BlockPos(aBaseMetaTileEntity).getLocationString())); + } return false; } else if (aFoundMeta != aExpectedMeta) { -- cgit