From a39924a5a490eec592aa0982f7f855155773e471 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Tue, 9 Oct 2012 14:45:35 -0700 Subject: [PATCH] Fixed RP2 wires connecting to normal pipes --- .../transport/BlockGenericPipe.java | 17 +++++++++++--- common/buildcraft/transport/Pipe.java | 23 ++++++++++++------- .../transport/pipes/PipeItemsGold.java | 5 ++++ .../transport/pipes/PipeItemsIron.java | 5 +++- .../transport/pipes/PipeItemsWood.java | 6 +++++ .../transport/pipes/PipeLiquidsIron.java | 5 +++- .../transport/pipes/PipeLiquidsWood.java | 7 ++++++ 7 files changed, 55 insertions(+), 13 deletions(-) diff --git a/common/buildcraft/transport/BlockGenericPipe.java b/common/buildcraft/transport/BlockGenericPipe.java index b9eeb2fc..102d9554 100644 --- a/common/buildcraft/transport/BlockGenericPipe.java +++ b/common/buildcraft/transport/BlockGenericPipe.java @@ -40,7 +40,7 @@ import net.minecraft.src.World; public class BlockGenericPipe extends BlockContainer { - /** Defined subprograms **************************************************/ + /* Defined subprograms **************************************************/ public BlockGenericPipe(int i) { super(i, Material.glass); @@ -261,7 +261,7 @@ public class BlockGenericPipe extends BlockContainer { return pipe.itemID; } - /** Wrappers *************************************************************/ + /* Wrappers *************************************************************/ @Override public void onNeighborBlockChange(World world, int x, int y, int z, int l) { @@ -445,6 +445,17 @@ public class BlockGenericPipe extends BlockContainer { if (isValid(pipe)) pipe.onEntityCollidedWithBlock(entity); } + + @Override + public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) + { + Pipe pipe = getPipe(world, x, y, z); + + if (isValid(pipe)) + return pipe.canConnectRedstone() + else + return false; + } @Override public boolean isPoweringTo(IBlockAccess iblockaccess, int x, int y, int z, int l) { @@ -480,7 +491,7 @@ public class BlockGenericPipe extends BlockContainer { pipe.randomDisplayTick(random); } - /** Registration *********************************************************/ + /* Registration *********************************************************/ public static TreeMap> pipes = new TreeMap>(); diff --git a/common/buildcraft/transport/Pipe.java b/common/buildcraft/transport/Pipe.java index 8de03432..7448c5eb 100644 --- a/common/buildcraft/transport/Pipe.java +++ b/common/buildcraft/transport/Pipe.java @@ -351,6 +351,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory { public void onEntityCollidedWithBlock(Entity entity) { } + + public boolean canConnectRedstone() { + if(hasGate()) + return true; + + return false; + } public boolean isPoweringTo(int l) { if (!broadcastRedstone) @@ -487,15 +494,15 @@ public abstract class Pipe implements IPipe, IDropControlInventory { public void resetGate() { gate = null; activatedTriggers = new Trigger[activatedTriggers.length]; - triggerParameters = new ITriggerParameter[triggerParameters.length]; - activatedActions = new Action[activatedActions.length]; - broadcastSignal = new boolean[] { false, false, false, false }; - if (broadcastRedstone) { - updateNeighbors(true); - } - broadcastRedstone = false; + triggerParameters = new ITriggerParameter[triggerParameters.length]; + activatedActions = new Action[activatedActions.length]; + broadcastSignal = new boolean[] { false, false, false, false }; + if (broadcastRedstone) { + updateNeighbors(true); + } + broadcastRedstone = false; //worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord); - container.scheduleRenderUpdate(); + container.scheduleRenderUpdate(); } private void resolveActions() { diff --git a/common/buildcraft/transport/pipes/PipeItemsGold.java b/common/buildcraft/transport/pipes/PipeItemsGold.java index 2514d144..fc2630da 100644 --- a/common/buildcraft/transport/pipes/PipeItemsGold.java +++ b/common/buildcraft/transport/pipes/PipeItemsGold.java @@ -74,4 +74,9 @@ public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook { public void readjustSpeed(IPipedItem item) { ((PipeTransportItems) transport).defaultReajustSpeed(item); } + + @Override + public boolean canConnectRedstone() { + return true; + } } diff --git a/common/buildcraft/transport/pipes/PipeItemsIron.java b/common/buildcraft/transport/pipes/PipeItemsIron.java index 046ba561..e7aae39e 100644 --- a/common/buildcraft/transport/pipes/PipeItemsIron.java +++ b/common/buildcraft/transport/pipes/PipeItemsIron.java @@ -43,5 +43,8 @@ public class PipeItemsIron extends Pipe { } } - + @Override + public boolean canConnectRedstone() { + return true; + } } diff --git a/common/buildcraft/transport/pipes/PipeItemsWood.java b/common/buildcraft/transport/pipes/PipeItemsWood.java index 184e3d51..e0fa3907 100644 --- a/common/buildcraft/transport/pipes/PipeItemsWood.java +++ b/common/buildcraft/transport/pipes/PipeItemsWood.java @@ -221,4 +221,10 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor { return getPowerProvider().getMaxEnergyReceived(); } + @Override + public boolean canConnectRedstone() { + if(PowerFramework.currentFramework instanceof RedstonePowerFramework) + return true; + return super.canConnectRedstone(); + } } diff --git a/common/buildcraft/transport/pipes/PipeLiquidsIron.java b/common/buildcraft/transport/pipes/PipeLiquidsIron.java index b730fdde..9edd79c7 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsIron.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsIron.java @@ -41,5 +41,8 @@ public class PipeLiquidsIron extends Pipe { } } - + @Override + public boolean canConnectRedstone() { + return true; + } } diff --git a/common/buildcraft/transport/pipes/PipeLiquidsWood.java b/common/buildcraft/transport/pipes/PipeLiquidsWood.java index 4306267d..53fe998e 100644 --- a/common/buildcraft/transport/pipes/PipeLiquidsWood.java +++ b/common/buildcraft/transport/pipes/PipeLiquidsWood.java @@ -136,4 +136,11 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor { public int powerRequest() { return getPowerProvider().getMaxEnergyReceived(); } + + @Override + public boolean canConnectRedstone() { + if(PowerFramework.currentFramework instanceof RedstonePowerFramework) + return true; + return super.canConnectRedstone(); + } }