use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class PipeManagerWatchingPacket method processPacket.
@Override
public void processPacket(EntityPlayer player) {
LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
return;
}
CoreRoutedPipe cPipe = (CoreRoutedPipe) pipe.pipe;
if (start) {
cPipe.getOrderManager().startWatching(player);
} else {
cPipe.getOrderManager().stopWatching(player);
}
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class PipeSignTypes method processPacket.
@Override
public void processPacket(EntityPlayer player) {
LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld(), LTGPCompletionCheck.PIPE);
if (pipe == null || !pipe.isInitialized()) {
return;
}
((CoreRoutedPipe) pipe.pipe).handleSignPacket(types);
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class FluidRoutedPipe method enabledUpdateEntity.
@Override
public void enabledUpdateEntity() {
super.enabledUpdateEntity();
if (canInsertFromSideToTanks()) {
int validDirections = 0;
List<Pair<TileEntity, ForgeDirection>> list = getAdjacentTanks(true);
for (Pair<TileEntity, ForgeDirection> pair : list) {
if (pair.getValue1() instanceof LogisticsTileGenericPipe) {
if (((LogisticsTileGenericPipe) pair.getValue1()).pipe instanceof CoreRoutedPipe) {
continue;
}
}
FluidTank tank = ((PipeFluidTransportLogistics) transport).sideTanks[pair.getValue2().ordinal()];
validDirections++;
if (tank.getFluid() == null) {
continue;
}
int filled = ((IFluidHandler) pair.getValue1()).fill(pair.getValue2().getOpposite(), tank.getFluid().copy(), true);
if (filled == 0) {
continue;
}
FluidStack drain = tank.drain(filled, true);
if (drain == null || filled != drain.amount) {
if (LPConstants.DEBUG) {
throw new UnsupportedOperationException("Fluid Multiplication");
}
}
}
if (validDirections == 0) {
return;
}
FluidTank tank = ((PipeFluidTransportLogistics) transport).internalTank;
FluidStack stack = tank.getFluid();
if (stack == null) {
return;
}
for (Pair<TileEntity, ForgeDirection> pair : list) {
if (pair.getValue1() instanceof LogisticsTileGenericPipe) {
if (((LogisticsTileGenericPipe) pair.getValue1()).pipe instanceof CoreRoutedPipe) {
continue;
}
}
FluidTank tankSide = ((PipeFluidTransportLogistics) transport).sideTanks[pair.getValue2().ordinal()];
stack = tank.getFluid();
if (stack == null) {
continue;
}
stack = stack.copy();
int filled = tankSide.fill(stack, true);
if (filled == 0) {
continue;
}
FluidStack drain = tank.drain(filled, true);
if (drain == null || filled != drain.amount) {
if (LPConstants.DEBUG) {
throw new UnsupportedOperationException("Fluid Multiplication");
}
}
}
}
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class BaseWrapperClass method load.
@Override
public void load(NBTTagCompound nbt) {
if (object != null) {
return;
}
String type = nbt.getString("Type");
if (type.equals("")) {
return;
}
if (type.equals("LPGlobalCCAccess")) {
object = LogisticsPipes.getComputerLP();
checkType();
} else if (type.equals("CoreRoutedPipe")) {
int x = nbt.getInteger("X");
int y = nbt.getInteger("Y");
int z = nbt.getInteger("Z");
final DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
final int dim = nbt.getInteger("Dim");
QueuedTasks.queueTask(() -> {
World world = DimensionManager.getWorld(dim);
if (world != null) {
TileEntity tile = pos.getTileEntity(world);
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof CoreRoutedPipe) {
object = ((LogisticsTileGenericPipe) tile).pipe;
checkType();
}
}
return null;
});
} else if (type.equals("CCItemIdentifierImplementation")) {
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
if (stack != null) {
object = new CCItemIdentifierImplementation(ItemIdentifier.get(stack));
checkType();
}
} else if (type.equals("CCItemIdentifierStackImplementation")) {
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
if (stack != null) {
object = new CCItemIdentifierStackImplementation(ItemIdentifierStack.getFromStack(stack));
checkType();
}
} else if (type.equals("CCItemIdentifierBuilder")) {
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
if (stack != null) {
CCItemIdentifierBuilder builder = new CCItemIdentifierBuilder();
builder.setItemID(Double.valueOf(Item.getIdFromItem(stack.getItem())));
builder.setItemData(Double.valueOf(stack.getItemDamage()));
object = builder;
checkType();
}
} else if (type.equals("LogisticsSolidTileEntity")) {
int x = nbt.getInteger("X");
int y = nbt.getInteger("Y");
int z = nbt.getInteger("Z");
final DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
final int dim = nbt.getInteger("Dim");
QueuedTasks.queueTask(() -> {
World world = DimensionManager.getWorld(dim);
if (world != null) {
TileEntity tile = pos.getTileEntity(world);
if (tile instanceof LogisticsSolidTileEntity) {
object = tile;
checkType();
}
}
return null;
});
} else {
System.out.println("Unknown type to load");
}
}
use of logisticspipes.pipes.basic.CoreRoutedPipe in project LogisticsPipes by RS485.
the class LogisticsRoutingBoardRobot method refreshRoutingTable.
private void refreshRoutingTable() {
TileEntity tile = getLinkedStationPosition().getTileEntity(robot.worldObj);
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).isRoutingPipe()) {
CoreRoutedPipe pipe = ((LogisticsTileGenericPipe) tile).getRoutingPipe();
pipe.getRouter().update(true, pipe);
}
}
Aggregations