From df8c981bd3dd0ba8c6bb3e538920f34e4e80fc76 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Thu, 14 Mar 2019 15:21:13 +0000 Subject: % Made Control Cores Optional, they will still lock to the Core's tier if present. % Tweaked Control Core recipes. % Updated CircleCI config.yml. $ Fixed mild issue where Control Core Modules could be shared between multiblocks. --- .../GT_MetaTileEntity_Hatch_ControlCore.java | 24 +++++++++++++++++++ .../base/GregtechMeta_MultiBlockBase.java | 27 ++++++++++++++-------- 2 files changed, 41 insertions(+), 10 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java index fe0ffd5dc8..7a532807c8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ControlCore.java @@ -8,16 +8,20 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.item.general.ItemControlCore; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; + + public BlockPos mControllerLocation; public GT_MetaTileEntity_Hatch_ControlCore(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, getSlots(aTier), "Core determines maximum tier machine will operate at"); @@ -113,4 +117,24 @@ public class GT_MetaTileEntity_Hatch_ControlCore extends GT_MetaTileEntity_Hatch public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return aSide == getBaseMetaTileEntity().getFrontFacing() && (aStack != null && aStack.getItem() instanceof ItemControlCore); } + + public boolean setOwner(TileEntity aTileEntity) { + if (mControllerLocation != null) { + return false; + } + else { + mControllerLocation = new BlockPos(aTileEntity); + return true; + } + } + + public boolean setOwner(IGregTechTileEntity aTileEntity) { + if (mControllerLocation != null) { + return false; + } + else { + mControllerLocation = new BlockPos(aTileEntity); + return true; + } + } } 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 d011043a57..873c93aae1 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 @@ -71,7 +71,7 @@ extends GT_MetaTileEntity_MultiBlockBase { - private static final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true; + public static final boolean DEBUG_DISABLE_CORES_TEMPORARILY = true; static { @@ -203,7 +203,7 @@ GT_MetaTileEntity_MultiBlockBase { } } - int tTier = requireControlCores ? this.getControlCoreTier() : -1; + int tTier = this.getControlCoreTier(); mInfo.add(getMachineTooltip()); @@ -554,8 +554,8 @@ GT_MetaTileEntity_MultiBlockBase { //Control Core to control the Multiblocks behaviour. int aControlCoreTier = getControlCoreTier(); - - //If no core, return false; + + //If no core, return false; if (aControlCoreTier == 0 && requireControlCores) { log("No control core found."); return false; @@ -640,7 +640,7 @@ GT_MetaTileEntity_MultiBlockBase { //Only Overclock as high as the control circuit. byte tTierOld = tTier; - tTier = requireControlCores ? (byte) aControlCoreTier : tTierOld; + tTier = getControlCoreTier() > 0 ? (byte) aControlCoreTier : tTierOld; // Overclock if (this.mEUt <= 16) { @@ -954,10 +954,10 @@ GT_MetaTileEntity_MultiBlockBase { public int getControlCoreTier() { //Always return best tier if config is off. - boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; + /*boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; if (!aCoresConfig) { return 10; - } + }*/ if (mControlCoreBus.isEmpty()) { log("No Control Core Modules Found."); @@ -998,9 +998,16 @@ GT_MetaTileEntity_MultiBlockBase { log("Tried to add a secondary control core module."); return false; } - - log("Adding control core module."); - return addToMachineListInternal(mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); + + GT_MetaTileEntity_Hatch_ControlCore Module = (GT_MetaTileEntity_Hatch_ControlCore) aMetaTileEntity; + + if (Module != null) { + if (Module.setOwner(aTileEntity)) { + log("Adding control core module."); + return addToMachineListInternal(mControlCoreBus, aMetaTileEntity, aBaseCasingIndex); + } + } + return false; } @Override -- cgit