begin refactoring internal TileGenericPipe usage to IPipeTile
This commit is contained in:
parent
8fba5bb6a1
commit
e489b7857a
16 changed files with 91 additions and 79 deletions
|
@ -642,7 +642,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
}
|
}
|
||||||
} else if (currentItem.getItem() == Items.water_bucket) {
|
} else if (currentItem.getItem() == Items.water_bucket) {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
pipe.container.setColor(-1);
|
pipe.container.setPipeColor(-1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (currentItem.getItem() instanceof IPipePluggableItem) {
|
} else if (currentItem.getItem() instanceof IPipePluggableItem) {
|
||||||
|
@ -1101,7 +1101,7 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
||||||
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) {
|
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour) {
|
||||||
TileGenericPipe pipeTile = (TileGenericPipe) world.getTileEntity(x, y, z);
|
TileGenericPipe pipeTile = (TileGenericPipe) world.getTileEntity(x, y, z);
|
||||||
if (!pipeTile.hasBlockingPluggable(side)) {
|
if (!pipeTile.hasBlockingPluggable(side)) {
|
||||||
return pipeTile.setColor(colour);
|
return pipeTile.setPipeColor(colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -97,8 +97,8 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
Pipe<?> otherPipe;
|
Pipe<?> otherPipe;
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
otherPipe = ((TileGenericPipe) tile).pipe;
|
otherPipe = (Pipe<?>) ((IPipeTile)tile).getPipe();
|
||||||
if (!BlockGenericPipe.isFullyDefined(otherPipe)) {
|
if (!BlockGenericPipe.isFullyDefined(otherPipe)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -221,12 +221,13 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
IPipeTile tilePipe = (IPipeTile) tile;
|
||||||
|
Pipe<?> pipe = (Pipe<?>) tilePipe.getPipe();
|
||||||
|
|
||||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
if (BlockGenericPipe.isFullyDefined(pipe)) {
|
||||||
if (isWireConnectedTo(tile, color)) {
|
if (isWireConnectedTo(tile, color)) {
|
||||||
foundBiggerSignal |= receiveSignal(tilePipe.pipe.signalStrength[color.ordinal()] - 1, color);
|
foundBiggerSignal |= receiveSignal(pipe.signalStrength[color.ordinal()] - 1, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,11 +241,12 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
IPipeTile tilePipe = (IPipeTile) tile;
|
||||||
|
Pipe<?> pipe = (Pipe<?>) tilePipe.getPipe();
|
||||||
|
|
||||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
if (BlockGenericPipe.isFullyDefined(pipe)) {
|
||||||
tilePipe.pipe.internalUpdateScheduled = true;
|
pipe.internalUpdateScheduled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,12 +284,13 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection o : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
IPipeTile tilePipe = (IPipeTile) tile;
|
||||||
|
Pipe<?> pipe = (Pipe<?>) tilePipe.getPipe();
|
||||||
|
|
||||||
if (BlockGenericPipe.isFullyDefined(tilePipe.pipe) && tilePipe.pipe.wireSet[wire.ordinal()]) {
|
if (BlockGenericPipe.isFullyDefined(pipe) && pipe.wireSet[wire.ordinal()]) {
|
||||||
if (isWireConnectedTo(tile, wire)) {
|
if (isWireConnectedTo(tile, wire)) {
|
||||||
tilePipe.pipe.receiveSignal(signalStrength[wire.ordinal()] - 1, wire);
|
pipe.receiveSignal(signalStrength[wire.ordinal()] - 1, wire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -366,7 +369,7 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
|
|
||||||
TileEntity tile = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe && container.isPipeConnected(o)) {
|
if (tile instanceof IPipeTile && container.isPipeConnected(o)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return getMaxRedstoneOutput(o);
|
return getMaxRedstoneOutput(o);
|
||||||
|
@ -472,21 +475,21 @@ public abstract class Pipe<T extends PipeTransport> implements IDropControlInven
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWireConnectedTo(TileEntity tile, PipeWire color) {
|
public boolean isWireConnectedTo(TileEntity tile, PipeWire color) {
|
||||||
if (!(tile instanceof TileGenericPipe)) {
|
if (!(tile instanceof IPipeTile)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileGenericPipe tilePipe = (TileGenericPipe) tile;
|
Pipe<?> pipe = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
|
|
||||||
if (!BlockGenericPipe.isFullyDefined(tilePipe.pipe)) {
|
if (!BlockGenericPipe.isFullyDefined(pipe)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tilePipe.pipe.wireSet[color.ordinal()]) {
|
if (!pipe.wireSet[color.ordinal()]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tilePipe.pipe.transport instanceof PipeTransportStructure || transport instanceof PipeTransportStructure
|
return pipe.transport instanceof PipeTransportStructure || transport instanceof PipeTransportStructure
|
||||||
|| Utils.checkPipesConnections(
|
|| Utils.checkPipesConnections(
|
||||||
container, tile);
|
container, tile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||||
import buildcraft.BuildCraftCore;
|
import buildcraft.BuildCraftCore;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.SafeTimeTracker;
|
import buildcraft.api.core.SafeTimeTracker;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
import buildcraft.api.transport.IPipeTile;
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.core.DefaultProps;
|
import buildcraft.core.DefaultProps;
|
||||||
import buildcraft.core.utils.MathUtils;
|
import buildcraft.core.utils.MathUtils;
|
||||||
|
@ -195,21 +196,21 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canReceiveFluid(ForgeDirection o) {
|
private boolean canReceiveFluid(ForgeDirection o) {
|
||||||
TileEntity entity = container.getTile(o);
|
TileEntity tile = container.getTile(o);
|
||||||
|
|
||||||
if (!container.isPipeConnected(o)) {
|
if (!container.isPipeConnected(o)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> pipe = ((TileGenericPipe) entity).pipe;
|
Pipe<?> pipe = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
|
|
||||||
if (pipe == null || !inputOpen(o.getOpposite())) {
|
if (pipe == null || !inputOpen(o.getOpposite())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof IFluidHandler) {
|
if (tile instanceof IFluidHandler) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,8 +536,8 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> pipe2 = ((TileGenericPipe) tile).pipe;
|
Pipe<?> pipe2 = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportFluids)) {
|
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportFluids)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +553,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tile instanceof TileGenericPipe;
|
return tile instanceof IPipeTile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -228,11 +228,11 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof TileGenericPipe) {
|
if (entity instanceof IPipeTile) {
|
||||||
TileGenericPipe pipe = (TileGenericPipe) entity;
|
Pipe<?> pipe = (Pipe<?>) ((IPipeTile) entity).getPipe();
|
||||||
|
|
||||||
//return !pipe.pipe.isClosed() && pipe.pipe.transport instanceof PipeTransportItems;
|
//return !pipe.pipe.isClosed() && pipe.pipe.transport instanceof PipeTransportItems;
|
||||||
return pipe.pipe.inputOpen(o.getOpposite()) && pipe.pipe.transport instanceof PipeTransportItems;
|
return pipe.inputOpen(o.getOpposite()) && pipe.transport instanceof PipeTransportItems;
|
||||||
} else if (entity instanceof IInventory && item.getInsertionHandler().canInsertItem(item, (IInventory) entity)) {
|
} else if (entity instanceof IInventory && item.getInsertionHandler().canInsertItem(item, (IInventory) entity)) {
|
||||||
if (Transactor.getTransactorFor(entity).add(item.getItemStack(), o.getOpposite(), false).stackSize > 0) {
|
if (Transactor.getTransactorFor(entity).add(item.getItemStack(), o.getOpposite(), false).stackSize > 0) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -300,10 +300,10 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean passToNextPipe(TravelingItem item, TileEntity tile) {
|
private boolean passToNextPipe(TravelingItem item, TileEntity tile) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
TileGenericPipe pipe = (TileGenericPipe) tile;
|
Pipe<?> pipe = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (BlockGenericPipe.isValid(pipe.pipe) && pipe.pipe.transport instanceof PipeTransportItems) {
|
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof PipeTransportItems) {
|
||||||
((PipeTransportItems) pipe.pipe.transport).injectItem(item, item.output);
|
((PipeTransportItems) pipe.transport).injectItem(item, item.output);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,8 +474,8 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> pipe2 = ((TileGenericPipe) tile).pipe;
|
Pipe<?> pipe2 = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportItems)) {
|
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportItems)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ public class PipeTransportItems extends PipeTransport {
|
||||||
return slots != null && slots.length > 0;
|
return slots != null && slots.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tile instanceof TileGenericPipe || (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0);
|
return tile instanceof IPipeTile || (tile instanceof IInventory && ((IInventory) tile).getSizeInventory() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,8 +88,8 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> pipe2 = ((TileGenericPipe) tile).pipe;
|
Pipe<?> pipe2 = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportPower)) {
|
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportPower)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -222,11 +222,11 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
int powerConsumed = powerQuery[out] * totalPowerContained / totalPowerQuery;
|
int powerConsumed = powerQuery[out] * totalPowerContained / totalPowerQuery;
|
||||||
boolean tilePowered = false;
|
boolean tilePowered = false;
|
||||||
|
|
||||||
if (tiles[out] instanceof TileGenericPipe) {
|
if (tiles[out] instanceof IPipeTile) {
|
||||||
// Transmit power to the nearby pipe
|
// Transmit power to the nearby pipe
|
||||||
|
|
||||||
TileGenericPipe nearbyTile = (TileGenericPipe) tiles[out];
|
Pipe<?> nearbyPipe = (Pipe<?>) ((IPipeTile) tiles[out]).getPipe();
|
||||||
PipeTransportPower nearbyTransport = (PipeTransportPower) nearbyTile.pipe.transport;
|
PipeTransportPower nearbyTransport = (PipeTransportPower) nearbyPipe.transport;
|
||||||
powerConsumed = nearbyTransport.receiveEnergy(
|
powerConsumed = nearbyTransport.receiveEnergy(
|
||||||
ForgeDirection.VALID_DIRECTIONS[out].getOpposite(),
|
ForgeDirection.VALID_DIRECTIONS[out].getOpposite(),
|
||||||
powerConsumed);
|
powerConsumed);
|
||||||
|
@ -305,7 +305,7 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
|
|
||||||
TileEntity tile = tiles [dir.ordinal()];
|
TileEntity tile = tiles [dir.ordinal()];
|
||||||
|
|
||||||
if (tile instanceof TileGenericPipe && ((TileGenericPipe) tile).pipe.transport instanceof PipeTransportPower) {
|
if (tile instanceof IPipeTile && ((Pipe<?>) ((IPipeTile) tile).getPipe()).transport instanceof PipeTransportPower) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,14 +357,14 @@ public class PipeTransportPower extends PipeTransport {
|
||||||
if (tiles[i] != null) {
|
if (tiles[i] != null) {
|
||||||
TileEntity entity = tiles[i];
|
TileEntity entity = tiles[i];
|
||||||
|
|
||||||
if (entity instanceof TileGenericPipe) {
|
if (entity instanceof IPipeTile) {
|
||||||
TileGenericPipe nearbyTile = (TileGenericPipe) entity;
|
Pipe<?> nearbyPipe = (Pipe<?>) ((IPipeTile) entity).getPipe();
|
||||||
|
|
||||||
if (nearbyTile.pipe == null) {
|
if (nearbyPipe == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
PipeTransportPower nearbyTransport = (PipeTransportPower) nearbyTile.pipe.transport;
|
PipeTransportPower nearbyTransport = (PipeTransportPower) nearbyPipe.transport;
|
||||||
nearbyTransport.requestEnergy(ForgeDirection.VALID_DIRECTIONS[i].getOpposite(), transferQuery[i]);
|
nearbyTransport.requestEnergy(ForgeDirection.VALID_DIRECTIONS[i].getOpposite(), transferQuery[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@ public class PipeTransportStructure extends PipeTransport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> pipe2 = ((TileGenericPipe) tile).pipe;
|
Pipe<?> pipe2 = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
|
|
||||||
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportStructure)) {
|
if (BlockGenericPipe.isValid(pipe2) && !(pipe2.transport instanceof PipeTransportStructure)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -431,19 +431,19 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
||||||
|
|
||||||
public void initializeFromItemMetadata(int i) {
|
public void initializeFromItemMetadata(int i) {
|
||||||
if (i >= 1 && i <= 16) {
|
if (i >= 1 && i <= 16) {
|
||||||
setColor((i - 1) & 15);
|
setPipeColor((i - 1) & 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemMetadata() {
|
public int getItemMetadata() {
|
||||||
return getColor() >= 0 ? (1 + getColor()) : 0;
|
return getPipeColor() >= 0 ? (1 + getPipeColor()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getPipeColor() {
|
||||||
return worldObj.isRemote ? renderState.glassColor : this.glassColor;
|
return worldObj.isRemote ? renderState.glassColor : this.glassColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setColor(int color) {
|
public boolean setPipeColor(int color) {
|
||||||
// -1 = no color
|
// -1 = no color
|
||||||
if (!worldObj.isRemote && color >= -1 && color < 16 && glassColor != color) {
|
if (!worldObj.isRemote && color >= -1 && color < 16 && glassColor != color) {
|
||||||
glassColor = color;
|
glassColor = color;
|
||||||
|
@ -555,8 +555,8 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
||||||
if (tile instanceof ITileBufferHolder) {
|
if (tile instanceof ITileBufferHolder) {
|
||||||
((ITileBufferHolder) tile).blockCreated(o, BuildCraftTransport.genericPipeBlock, this);
|
((ITileBufferHolder) tile).blockCreated(o, BuildCraftTransport.genericPipeBlock, this);
|
||||||
}
|
}
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
((TileGenericPipe) tile).scheduleNeighborChange();
|
((IPipeTile) tile).scheduleNeighborChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,18 +721,18 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (with instanceof TileGenericPipe) {
|
if (with instanceof IPipeTile) {
|
||||||
TileGenericPipe other = (TileGenericPipe) with;
|
IPipeTile other = (IPipeTile) with;
|
||||||
|
|
||||||
if (other.hasBlockingPluggable(side.getOpposite())) {
|
if (other.hasBlockingPluggable(side.getOpposite())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.glassColor >= 0 && glassColor >= 0 && other.glassColor != glassColor) {
|
if (other.getPipeColor() >= 0 && glassColor >= 0 && other.getPipeColor() != glassColor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pipe<?> otherPipe = ((TileGenericPipe) with).pipe;
|
Pipe<?> otherPipe = (Pipe<?>) other.getPipe();
|
||||||
|
|
||||||
if (!BlockGenericPipe.isValid(otherPipe)) {
|
if (!BlockGenericPipe.isValid(otherPipe)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -769,7 +769,7 @@ public class TileGenericPipe extends TileEntity implements IFluidHandler,
|
||||||
return canPipeConnect_internal(with, side);
|
return canPipeConnect_internal(with, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasBlockingPluggable(ForgeDirection side) {
|
public boolean hasBlockingPluggable(ForgeDirection side) {
|
||||||
PipePluggable pluggable = getPipePluggable(side);
|
PipePluggable pluggable = getPipePluggable(side);
|
||||||
if (pluggable == null) {
|
if (pluggable == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -24,10 +24,11 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportFluids;
|
import buildcraft.transport.PipeTransportFluids;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.transport.gates.StatementSlot;
|
||||||
import buildcraft.transport.statements.ActionPipeDirection;
|
import buildcraft.transport.statements.ActionPipeDirection;
|
||||||
|
|
||||||
|
@ -38,8 +39,8 @@ public class PipeFluidsIron extends Pipe<PipeTransportFluids> {
|
||||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> otherPipe = ((TileGenericPipe) tile).pipe;
|
Pipe<?> otherPipe = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (otherPipe instanceof PipeFluidsWood || otherPipe instanceof PipeStructureCobblestone) {
|
if (otherPipe instanceof PipeFluidsWood || otherPipe instanceof PipeStructureCobblestone) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.IPipeConnectionForced;
|
import buildcraft.transport.IPipeConnectionForced;
|
||||||
import buildcraft.transport.IPipeTransportFluidsHook;
|
import buildcraft.transport.IPipeTransportFluidsHook;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
|
@ -47,7 +48,7 @@ public class PipeFluidsSandstone extends Pipe<PipeTransportFluids> implements IP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||||
if (!(container.getTile(from) instanceof TileGenericPipe)) {
|
if (!(container.getTile(from) instanceof IPipeTile)) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return transport.internalTanks[from.ordinal()].fill(resource, doFill);
|
return transport.internalTanks[from.ordinal()].fill(resource, doFill);
|
||||||
|
@ -56,7 +57,7 @@ public class PipeFluidsSandstone extends Pipe<PipeTransportFluids> implements IP
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side);
|
return (tile instanceof IPipeTile) && super.canPipeConnect(tile, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,11 +31,11 @@ import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.ISerializable;
|
import buildcraft.api.core.ISerializable;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
import buildcraft.api.tools.IToolWrench;
|
import buildcraft.api.tools.IToolWrench;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.core.utils.ColorUtils;
|
import buildcraft.core.utils.ColorUtils;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
import buildcraft.transport.TileGenericPipe;
|
|
||||||
import buildcraft.transport.TransportConstants;
|
import buildcraft.transport.TransportConstants;
|
||||||
import buildcraft.transport.TravelingItem;
|
import buildcraft.transport.TravelingItem;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.transport.gates.StatementSlot;
|
||||||
|
@ -51,8 +51,8 @@ public class PipeItemsDaizuli extends Pipe<PipeTransportItems> implements ISeria
|
||||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> otherPipe = ((TileGenericPipe) tile).pipe;
|
Pipe<?> otherPipe = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (otherPipe instanceof PipeItemsWood) {
|
if (otherPipe instanceof PipeItemsWood) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.statements.IActionInternal;
|
import buildcraft.api.statements.IActionInternal;
|
||||||
|
import buildcraft.api.transport.IPipe;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
import buildcraft.transport.PipeTransportItems;
|
import buildcraft.transport.PipeTransportItems;
|
||||||
|
@ -38,8 +40,8 @@ public class PipeItemsIron extends Pipe<PipeTransportItems> {
|
||||||
private PipeLogicIron logic = new PipeLogicIron(this) {
|
private PipeLogicIron logic = new PipeLogicIron(this) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidConnectingTile(TileEntity tile) {
|
protected boolean isValidConnectingTile(TileEntity tile) {
|
||||||
if (tile instanceof TileGenericPipe) {
|
if (tile instanceof IPipeTile) {
|
||||||
Pipe<?> otherPipe = ((TileGenericPipe) tile).pipe;
|
Pipe<?> otherPipe = (Pipe<?>) ((IPipeTile) tile).getPipe();
|
||||||
if (otherPipe instanceof PipeItemsWood) {
|
if (otherPipe instanceof PipeItemsWood) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.IPipeConnectionForced;
|
import buildcraft.transport.IPipeConnectionForced;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
|
@ -43,7 +44,7 @@ public class PipeItemsSandstone extends Pipe implements IPipeConnectionForced {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side);
|
return (tile instanceof IPipeTile) && super.canPipeConnect(tile, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,7 @@ import cofh.api.energy.IEnergyHandler;
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
import buildcraft.api.core.Position;
|
import buildcraft.api.core.Position;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.api.transport.IStripesHandler;
|
import buildcraft.api.transport.IStripesHandler;
|
||||||
import buildcraft.api.transport.IStripesHandler.StripesHandlerType;
|
import buildcraft.api.transport.IStripesHandler.StripesHandlerType;
|
||||||
import buildcraft.api.transport.IStripesPipe;
|
import buildcraft.api.transport.IStripesPipe;
|
||||||
|
@ -143,13 +144,13 @@ public class PipeItemsStripes extends Pipe<PipeTransportItems> implements IEnerg
|
||||||
|
|
||||||
if (stack.stackSize > 0) {
|
if (stack.stackSize > 0) {
|
||||||
TileEntity targetTile = getWorld().getTileEntity((int) p.x, (int) p.y, (int) p.z);
|
TileEntity targetTile = getWorld().getTileEntity((int) p.x, (int) p.y, (int) p.z);
|
||||||
if (targetTile instanceof TileGenericPipe) {
|
if (targetTile instanceof IPipeTile) {
|
||||||
TravelingItem newItem = TravelingItem.make(
|
TravelingItem newItem = TravelingItem.make(
|
||||||
container.xCoord + 0.5,
|
container.xCoord + 0.5,
|
||||||
container.yCoord + TransportUtils.getPipeFloorOf(
|
container.yCoord + TransportUtils.getPipeFloorOf(
|
||||||
new ItemStack(BuildCraftTransport.pipeItemsStripes)),
|
new ItemStack(BuildCraftTransport.pipeItemsStripes)),
|
||||||
container.zCoord + 0.5, stack.copy());
|
container.zCoord + 0.5, stack.copy());
|
||||||
((PipeTransportItems) ((TileGenericPipe) targetTile).pipe.transport).injectItem(newItem, event.direction.getOpposite());
|
((PipeTransportItems) ((Pipe<?>)((IPipeTile) targetTile).getPipe()).transport).injectItem(newItem, event.direction.getOpposite());
|
||||||
|
|
||||||
stack.stackSize = 0;
|
stack.stackSize = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
import buildcraft.BuildCraftTransport;
|
import buildcraft.BuildCraftTransport;
|
||||||
import buildcraft.api.core.IIconProvider;
|
import buildcraft.api.core.IIconProvider;
|
||||||
|
import buildcraft.api.transport.IPipeTile;
|
||||||
import buildcraft.transport.IPipeConnectionForced;
|
import buildcraft.transport.IPipeConnectionForced;
|
||||||
import buildcraft.transport.Pipe;
|
import buildcraft.transport.Pipe;
|
||||||
import buildcraft.transport.PipeIconProvider;
|
import buildcraft.transport.PipeIconProvider;
|
||||||
|
@ -44,7 +45,7 @@ public class PipePowerSandstone extends Pipe<PipeTransportPower> implements IPip
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
public boolean canPipeConnect(TileEntity tile, ForgeDirection side) {
|
||||||
return (tile instanceof TileGenericPipe) && super.canPipeConnect(tile, side);
|
return (tile instanceof IPipeTile) && super.canPipeConnect(tile, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
|
||||||
protected RFBattery battery;
|
protected RFBattery battery;
|
||||||
|
|
||||||
private boolean full;
|
private boolean full;
|
||||||
private int requestedEnergy, sources;
|
private int requestedEnergy, sources, lastRequestedEnergy;
|
||||||
|
|
||||||
public PipePowerWood(Item item) {
|
public PipePowerWood(Item item) {
|
||||||
super(new PipeTransportPower(), item);
|
super(new PipeTransportPower(), item);
|
||||||
|
@ -128,6 +128,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastRequestedEnergy = requestedEnergy;
|
||||||
requestedEnergy = 0;
|
requestedEnergy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +179,7 @@ public class PipePowerWood extends Pipe<PipeTransportPower> implements IPipeTran
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive,
|
public int receiveEnergy(ForgeDirection from, int maxReceive,
|
||||||
boolean simulate) {
|
boolean simulate) {
|
||||||
if (from.ordinal() < 6 && powerSources[from.ordinal()]) {
|
if (from.ordinal() < 6 && powerSources[from.ordinal()]) {
|
||||||
return battery.receiveEnergy(maxReceive, simulate);
|
return battery.receiveEnergy(simulate ? Math.min(maxReceive, lastRequestedEnergy) : maxReceive, simulate);
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class PipeRendererWorld implements ISimpleBlockRenderingHandler {
|
||||||
PipeRenderState state = tile.renderState;
|
PipeRenderState state = tile.renderState;
|
||||||
IIconProvider icons = tile.getPipeIcons();
|
IIconProvider icons = tile.getPipeIcons();
|
||||||
FakeBlock fakeBlock = FakeBlock.INSTANCE;
|
FakeBlock fakeBlock = FakeBlock.INSTANCE;
|
||||||
int glassColor = tile.getColor();
|
int glassColor = tile.getPipeColor();
|
||||||
|
|
||||||
if (icons == null) {
|
if (icons == null) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue