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 {
/** 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<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 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() {

View file

@ -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;
}
}

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();
}
@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() {
return getPowerProvider().getMaxEnergyReceived();
}
@Override
public boolean canConnectRedstone() {
if(PowerFramework.currentFramework instanceof RedstonePowerFramework)
return true;
return super.canConnectRedstone();
}
}