fix #2758
This commit is contained in:
parent
47cba60750
commit
8e344b3f91
12 changed files with 69 additions and 40 deletions
|
@ -1,5 +1,6 @@
|
|||
Bugs fixed:
|
||||
|
||||
* [#2758] Connection issues with Big Reactors (asie)
|
||||
* [#2755] Stacked robots charging require the same amount of energy as a single robot (asie)
|
||||
* [#2754] Putting a cake package into a stamper only returns 1 milk bucket instead of 3 (asie)
|
||||
* [#2752] Emerald fluid pipe has no GUI texture (asie)
|
||||
|
|
|
@ -529,6 +529,24 @@ public class BlockGenericPipe extends BlockBuildCraft implements IColorRemovable
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, int x, int y, int z, int nx, int ny, int nz) {
|
||||
int ox = nx - x;
|
||||
int oy = ny - y;
|
||||
int oz = nz - z;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof TileGenericPipe) {
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
|
||||
if (d.offsetX == ox && d.offsetY == oy && d.offsetZ == oz) {
|
||||
((TileGenericPipe) tile).scheduleNeighborChange(d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int getRedstoneInputToPipe(World world, int x, int y, int z,
|
||||
ForgeDirection d) {
|
||||
|
|
|
@ -88,9 +88,8 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
|||
public void onBlockPlacedBy(EntityLivingBase placer) {
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
transport.onNeighborBlockChange(blockId);
|
||||
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
transport.onNeighborChange(direction);
|
||||
}
|
||||
|
||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||
|
|
|
@ -86,7 +86,7 @@ public abstract class PipeTransport {
|
|||
return true;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
}
|
||||
|
||||
public void onBlockPlaced() {
|
||||
|
|
|
@ -604,18 +604,16 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
super.onNeighborBlockChange(blockId);
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
super.onNeighborChange(direction);
|
||||
|
||||
for (ForgeDirection direction : directions) {
|
||||
if (!container.isPipeConnected(direction)) {
|
||||
sections[direction.ordinal()].reset();
|
||||
transferState[direction.ordinal()] = TransferState.None;
|
||||
renderCache.amount[direction.ordinal()] = 0;
|
||||
canReceiveCache[direction.ordinal()] = false;
|
||||
} else {
|
||||
canReceiveCache[direction.ordinal()] = canReceiveFluid(direction);
|
||||
}
|
||||
if (!container.isPipeConnected(direction)) {
|
||||
sections[direction.ordinal()].reset();
|
||||
transferState[direction.ordinal()] = TransferState.None;
|
||||
renderCache.amount[direction.ordinal()] = 0;
|
||||
canReceiveCache[direction.ordinal()] = false;
|
||||
} else {
|
||||
canReceiveCache[direction.ordinal()] = canReceiveFluid(direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,11 +142,9 @@ public class PipeTransportPower extends PipeTransport implements IDebuggable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
super.onNeighborBlockChange(blockId);
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
updateTile(side);
|
||||
}
|
||||
public void onNeighborChange(ForgeDirection side) {
|
||||
super.onNeighborChange(side);
|
||||
updateTile(side);
|
||||
}
|
||||
|
||||
private void updateTile(ForgeDirection side) {
|
||||
|
|
|
@ -81,6 +81,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
protected boolean deletePipe = false;
|
||||
protected boolean sendClientUpdate = false;
|
||||
protected boolean blockNeighborChange = false;
|
||||
protected int blockNeighborChangedSides = 0;
|
||||
protected boolean refreshRenderState = false;
|
||||
protected boolean pipeBound = false;
|
||||
protected boolean resyncGateExpansions = false;
|
||||
|
@ -399,8 +400,12 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
}
|
||||
|
||||
if (blockNeighborChange) {
|
||||
computeConnections();
|
||||
pipe.onNeighborBlockChange(0);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if ((blockNeighborChangedSides & (1 << i)) != 0) {
|
||||
blockNeighborChangedSides ^= 1 << i;
|
||||
computeConnection(ForgeDirection.getOrientation(i));
|
||||
}
|
||||
}
|
||||
blockNeighborChange = false;
|
||||
refreshRenderState = true;
|
||||
}
|
||||
|
@ -588,6 +593,12 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
|
||||
public void scheduleNeighborChange() {
|
||||
blockNeighborChange = true;
|
||||
blockNeighborChangedSides = 0x3F;
|
||||
}
|
||||
|
||||
public void scheduleNeighborChange(ForgeDirection direction) {
|
||||
blockNeighborChange = true;
|
||||
blockNeighborChangedSides |= direction == ForgeDirection.UNKNOWN ? 0x3F : (1 << direction.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -804,19 +815,23 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
|||
}
|
||||
|
||||
protected void computeConnections() {
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
computeConnection(side);
|
||||
}
|
||||
}
|
||||
|
||||
protected void computeConnection(ForgeDirection side) {
|
||||
TileBuffer[] cache = getTileCache();
|
||||
if (cache == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileBuffer t = cache[side.ordinal()];
|
||||
// For blocks which are not loaded, keep the old connection value.
|
||||
if (t.exists() || !initialized) {
|
||||
t.refresh();
|
||||
TileBuffer t = cache[side.ordinal()];
|
||||
// For blocks which are not loaded, keep the old connection value.
|
||||
if (t.exists() || !initialized) {
|
||||
t.refresh();
|
||||
|
||||
pipeConnectionsBuffer[side.ordinal()] = canPipeConnect(t.getTile(), side);
|
||||
}
|
||||
pipeConnectionsBuffer[side.ordinal()] = canPipeConnect(t.getTile(), side);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -61,9 +61,9 @@ public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
logic.switchOnRedstone();
|
||||
super.onNeighborBlockChange(blockId);
|
||||
super.onNeighborChange(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,9 +63,9 @@ public class PipeFluidsWood extends Pipe<PipeTransportFluids> implements IEnergy
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
logic.onNeighborBlockChange(blockId);
|
||||
super.onNeighborBlockChange(blockId);
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
logic.onNeighborBlockChange();
|
||||
super.onNeighborChange(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -65,9 +65,9 @@ public class PipeItemsIron extends Pipe<PipeTransportItems> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
logic.switchOnRedstone();
|
||||
super.onNeighborBlockChange(blockId);
|
||||
super.onNeighborChange(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,9 +63,9 @@ public class PipeItemsWood extends Pipe<PipeTransportItems> implements IEnergyHa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
logic.onNeighborBlockChange(blockId);
|
||||
super.onNeighborBlockChange(blockId);
|
||||
public void onNeighborChange(ForgeDirection direction) {
|
||||
logic.onNeighborBlockChange();
|
||||
super.onNeighborChange(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -96,7 +96,7 @@ public abstract class PipeLogicWood {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void onNeighborBlockChange(int blockId) {
|
||||
public void onNeighborBlockChange() {
|
||||
if (!pipe.container.getWorldObj().isRemote) {
|
||||
switchSourceIfNeeded();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue