Merge pull request #341 from CovertJaguar/master

Fixed RP2 wires connecting to normal pipes
This commit is contained in:
CovertJaguar 2012-10-09 14:50:01 -07:00
commit 26278298b7
7 changed files with 55 additions and 13 deletions

View file

@ -40,7 +40,7 @@ import net.minecraft.src.World;
public class BlockGenericPipe extends BlockContainer { public class BlockGenericPipe extends BlockContainer {
/** Defined subprograms **************************************************/ /* Defined subprograms **************************************************/
public BlockGenericPipe(int i) { public BlockGenericPipe(int i) {
super(i, Material.glass); super(i, Material.glass);
@ -261,7 +261,7 @@ public class BlockGenericPipe extends BlockContainer {
return pipe.itemID; return pipe.itemID;
} }
/** Wrappers *************************************************************/ /* Wrappers *************************************************************/
@Override @Override
public void onNeighborBlockChange(World world, int x, int y, int z, int l) { 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)) if (isValid(pipe))
pipe.onEntityCollidedWithBlock(entity); 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 @Override
public boolean isPoweringTo(IBlockAccess iblockaccess, int x, int y, int z, int l) { 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); pipe.randomDisplayTick(random);
} }
/** Registration *********************************************************/ /* Registration *********************************************************/
public static TreeMap<Integer, Class<? extends Pipe>> pipes = new TreeMap<Integer, Class<? extends Pipe>>(); public static TreeMap<Integer, Class<? extends Pipe>> pipes = new TreeMap<Integer, Class<? extends Pipe>>();

View file

@ -351,6 +351,13 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
public void onEntityCollidedWithBlock(Entity entity) { public void onEntityCollidedWithBlock(Entity entity) {
} }
public boolean canConnectRedstone() {
if(hasGate())
return true;
return false;
}
public boolean isPoweringTo(int l) { public boolean isPoweringTo(int l) {
if (!broadcastRedstone) if (!broadcastRedstone)
@ -487,15 +494,15 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
public void resetGate() { public void resetGate() {
gate = null; gate = null;
activatedTriggers = new Trigger[activatedTriggers.length]; activatedTriggers = new Trigger[activatedTriggers.length];
triggerParameters = new ITriggerParameter[triggerParameters.length]; triggerParameters = new ITriggerParameter[triggerParameters.length];
activatedActions = new Action[activatedActions.length]; activatedActions = new Action[activatedActions.length];
broadcastSignal = new boolean[] { false, false, false, false }; broadcastSignal = new boolean[] { false, false, false, false };
if (broadcastRedstone) { if (broadcastRedstone) {
updateNeighbors(true); updateNeighbors(true);
} }
broadcastRedstone = false; broadcastRedstone = false;
//worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord); //worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
container.scheduleRenderUpdate(); container.scheduleRenderUpdate();
} }
private void resolveActions() { private void resolveActions() {

View file

@ -74,4 +74,9 @@ public class PipeItemsGold extends Pipe implements IPipeTransportItemsHook {
public void readjustSpeed(IPipedItem item) { public void readjustSpeed(IPipedItem item) {
((PipeTransportItems) transport).defaultReajustSpeed(item); ((PipeTransportItems) transport).defaultReajustSpeed(item);
} }
@Override
public boolean canConnectRedstone() {
return true;
}
} }

View file

@ -43,5 +43,8 @@ public class PipeItemsIron extends Pipe {
} }
} }
@Override
public boolean canConnectRedstone() {
return true;
}
} }

View file

@ -221,4 +221,10 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }
@Override
public boolean canConnectRedstone() {
if(PowerFramework.currentFramework instanceof RedstonePowerFramework)
return true;
return super.canConnectRedstone();
}
} }

View file

@ -41,5 +41,8 @@ public class PipeLiquidsIron extends Pipe {
} }
} }
@Override
public boolean canConnectRedstone() {
return true;
}
} }

View file

@ -136,4 +136,11 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
public int powerRequest() { public int powerRequest() {
return getPowerProvider().getMaxEnergyReceived(); return getPowerProvider().getMaxEnergyReceived();
} }
@Override
public boolean canConnectRedstone() {
if(PowerFramework.currentFramework instanceof RedstonePowerFramework)
return true;
return super.canConnectRedstone();
}
} }