use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class ExitRoute method readRouter.
@SideOnly(Side.CLIENT)
private IRouter readRouter(LPDataInput input) {
DoubleCoordinates pos = new DoubleCoordinates(input);
TileEntity tile = pos.getTileEntity(MainProxy.getClientMainWorld());
if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof CoreRoutedPipe) {
return ((CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe).getRouter();
}
return null;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class TEControl method handleBlockUpdate.
public static void handleBlockUpdate(final World world, final LPWorldInfo info, BlockPos blockPos) {
if (info.isSkipBlockUpdateForWorld()) {
return;
}
if (info.getWorldTick() < 5) {
return;
}
final DoubleCoordinates pos = new DoubleCoordinates(blockPos);
if (info.getUpdateQueued().contains(pos)) {
return;
}
if (!pos.blockExists(world)) {
return;
}
final TileEntity tile = pos.getTileEntity(world);
if (SimpleServiceLocator.enderIOProxy.isBundledPipe(tile)) {
QueuedTasks.queueTask(() -> {
for (EnumFacing dir : EnumFacing.VALUES) {
DoubleCoordinates newPos = CoordinateUtils.sum(pos, dir);
if (!newPos.blockExists(world)) {
continue;
}
TileEntity nextTile = newPos.getTileEntity(world);
if (nextTile instanceof LogisticsTileGenericPipe) {
((LogisticsTileGenericPipe) nextTile).scheduleNeighborChange();
}
}
return null;
});
}
if (tile == null || ((ILPTEInformation) tile).getObject() == null) {
return;
}
if (SimpleServiceLocator.pipeInformationManager.isItemPipe(tile) || SimpleServiceLocator.specialtileconnection.isType(tile)) {
info.getUpdateQueued().add(pos);
QueuedTasks.queueTask(() -> {
for (EnumFacing dir : EnumFacing.VALUES) {
DoubleCoordinates newPos = CoordinateUtils.sum(pos, dir);
if (!newPos.blockExists(world)) {
continue;
}
TileEntity nextTile = newPos.getTileEntity(world);
if (nextTile != null && ((ILPTEInformation) nextTile).getObject() != null) {
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) nextTile).getObject().changeListeners)) {
listener.pipeModified(pos);
}
}
}
for (ITileEntityChangeListener listener : new ArrayList<>(((ILPTEInformation) tile).getObject().changeListeners)) {
listener.pipeModified(pos);
}
info.getUpdateQueued().remove(pos);
return null;
});
}
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LPDuctUnitItem method isLPBlockedSide.
public boolean isLPBlockedSide(int paramInt, boolean ignoreSystemDisconnect) {
EnumFacing dir = EnumFacing.getFront(paramInt);
AxisAlignedBB aabb = PIPE_CONN_BB.get(paramInt);
if (SimpleServiceLocator.mcmpProxy.checkIntersectionWith(pipe, aabb)) {
return true;
}
if (pipe.getTileCache() == null) {
DoubleCoordinates coords = new DoubleCoordinates(pipe.getTile().getPos());
if (CoordinateUtils.add(coords, dir, 1).getTileEntity(pipe.getWorld()) instanceof LogisticsTileGenericPipe) {
return true;
}
} else if (pipe.getTileCache()[dir.ordinal()].getTile() instanceof LogisticsTileGenericPipe) {
return true;
}
if (pipe.pipe != null && pipe.pipe.isSideBlocked(dir, ignoreSystemDisconnect)) {
return false;
}
TDPart.callSuperSideBlock = true;
boolean re = parent.isSideBlocked(paramInt);
TDPart.callSuperSideBlock = false;
return re;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class ClientViewController method handlePacket.
public void handlePacket(RoutingUpdateCanidatePipe routingUpdateCanidatePipe) {
DoubleCoordinates pos = routingUpdateCanidatePipe.getExitRoute().destination.getLPPosition();
canidates.add(routingUpdateCanidatePipe.getExitRoute().destination.getLPPosition());
// listHUD.add(new HUDRoutingTableDebugProvider(new HUDRoutingTableNewCandateUntrace(routingUpdateCanidatePipe.getExitRoute()), pos));
getDebugInformation(pos).isNew = true;
getDebugInformation(pos).newIndex = routingUpdateCanidatePipe.getExitRoute().debug.index;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LogisticsProgramCompilerTileEntity method update.
@Override
public void update() {
super.update();
if (MainProxy.isServer(world)) {
if (currentTask != null) {
wasAbleToConsumePower = false;
for (EnumFacing dir : EnumFacing.VALUES) {
if (dir == EnumFacing.UP)
continue;
DoubleCoordinates pos = CoordinateUtils.add(new DoubleCoordinates(this), dir);
TileEntity tile = pos.getTileEntity(getWorld());
if (!(tile instanceof LogisticsTileGenericPipe)) {
continue;
}
LogisticsTileGenericPipe tPipe = (LogisticsTileGenericPipe) tile;
if (!(tPipe.pipe.getClass() == PipeItemsBasicLogistics.class)) {
continue;
}
CoreRoutedPipe pipe = (CoreRoutedPipe) tPipe.pipe;
if (pipe.useEnergy(10)) {
if (taskType.equals("category")) {
taskProgress += 0.0005;
} else if (taskType.equals("program")) {
taskProgress += 0.0025;
} else if (taskType.equals("flash")) {
taskProgress += 0.01;
} else {
taskProgress += 1;
}
wasAbleToConsumePower = true;
}
}
if (taskProgress >= 1) {
if (taskType.equals("category")) {
NBTTagList list = getNBTTagListForKey("compilerCategories");
list.appendTag(new NBTTagString(currentTask.toString()));
} else if (taskType.equals("program")) {
NBTTagList list = getNBTTagListForKey("compilerPrograms");
list.appendTag(new NBTTagString(currentTask.toString()));
} else if (taskType.equals("flash")) {
if (!getInventory().getStackInSlot(1).isEmpty()) {
ItemStack programmer = getInventory().getStackInSlot(1);
if (!programmer.hasTagCompound()) {
programmer.setTagCompound(new NBTTagCompound());
}
programmer.getTagCompound().setString(ItemLogisticsProgrammer.RECIPE_TARGET, currentTask.toString());
}
} else {
throw new UnsupportedOperationException(taskType);
}
taskType = "";
currentTask = null;
taskProgress = 0;
wasAbleToConsumePower = false;
}
updateClient();
}
}
}
Aggregations