From fad72d1c68001be4cac656309a18436dadb862bb Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Mon, 3 Sep 2018 18:21:40 -0700 Subject: * Fix: Colored cables/pipes properly connect (or don't) to each other based on color * Trigger connection evaluation on painting of cables/pipes or machines * Trigger connection evaluation on placement of blocks -- IE: A wire/pipe open to air, and then a dirt block is placed on it - this will close the pipe/wire connection --- .../implementations/GT_MetaPipeEntity_Cable.java | 9 +-------- .../implementations/GT_MetaPipeEntity_Fluid.java | 11 +---------- .../implementations/GT_MetaPipeEntity_Item.java | 13 ++----------- 3 files changed, 4 insertions(+), 29 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index a393206257..e59be8921f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -295,7 +295,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile mTransferredVoltageLast20 = 0; mTransferredAmperageLast20OK=mTransferredAmperageLast20; mTransferredAmperageLast20 = 0; - if (!GT_Mod.gregtechproxy.gt6Cable) checkConnections(); + if (!GT_Mod.gregtechproxy.gt6Cable || mCheckConnections) checkConnections(); } } else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate(); } @@ -347,13 +347,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile final byte tSide = GT_Utility.getOppositeSide(aSide); final ForgeDirection tDir = ForgeDirection.getOrientation(tSide); - if (tTileEntity instanceof IColoredTileEntity) { - if (getBaseMetaTileEntity().getColorization() >= 0) { - byte tColor = ((IColoredTileEntity) tTileEntity).getColorization(); - if (tColor >= 0 && tColor != getBaseMetaTileEntity().getColorization()) return false; - } - } - // GT Machine handling if ((tTileEntity instanceof IEnergyConnected) && (((IEnergyConnected) tTileEntity).inputEnergyFrom(tSide, false) || ((IEnergyConnected) tTileEntity).outputsEnergyTo(tSide, false))) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 0644a07de1..b70697556d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -227,7 +227,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { mLastReceivedFrom = 0; } - if (!GT_Mod.gregtechproxy.gt6Pipe) checkConnections(); + if (!GT_Mod.gregtechproxy.gt6Pipe || mCheckConnections) checkConnections(); boolean shouldDistribute = (oLastReceivedFrom == mLastReceivedFrom); for (int i = 0, j = aBaseMetaTileEntity.getRandomNumber(mPipeAmount); i < mPipeAmount; i++) { @@ -387,15 +387,6 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (coverBehavior instanceof GT_Cover_Drain) return true; - if (gTileEntity != null && getBaseMetaTileEntity().getColorization() >= 0) { - // If we're painted... - byte tColor = gTileEntity.getColorization(); - if (tColor >= 0 && (tColor & 15) != (getBaseMetaTileEntity().getColorization() & 15)) { - // and the other tile entity is painted.. then we must both be painted the same color - return false; - } - } - // Tinker Construct Faucets return a null tank info, so check the class if (GregTech_API.mTConstruct && tTileEntity instanceof tconstruct.smeltery.logic.FaucetLogic) return true; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index a57e78885b..7cf91b6c86 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -158,7 +158,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE if (aBaseMetaTileEntity.isServerSide() && aTick % 10 == 0) { if (aTick % mTickTime == 0) mTransferredItems = 0; - if (!GT_Mod.gregtechproxy.gt6Pipe) checkConnections(); + if (!GT_Mod.gregtechproxy.gt6Pipe || mCheckConnections) checkConnections(); if (oLastReceivedFrom == mLastReceivedFrom) { doTickProfilingInThisTick = false; @@ -220,16 +220,8 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE final IGregTechTileEntity gTileEntity = (tTileEntity instanceof IGregTechTileEntity) ? (IGregTechTileEntity) tTileEntity : null; if (gTileEntity != null) { if (gTileEntity.getMetaTileEntity() == null) return false; - connectable = true; - if ( getBaseMetaTileEntity().getColorization() >= 0) { - // If we're painted... - byte tColor = gTileEntity.getColorization(); - if (tColor >= 0 && (tColor & 15) != (getBaseMetaTileEntity().getColorization() & 15)) { - // and the other tile entity is painted.. then we must both be painted the same color - return false; - } - } if (gTileEntity.getMetaTileEntity().connectsToItemPipe(tSide)) return true; + connectable = true; } if (tTileEntity instanceof IInventory) { @@ -239,7 +231,6 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE if (tTileEntity instanceof ISidedInventory) { int[] tSlots = ((ISidedInventory) tTileEntity).getAccessibleSlotsFromSide(tSide); if (tSlots == null || tSlots.length <= 0) return false; - connectable = true; } -- cgit