use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class SneakyUpgradeConfigGuiProvider method getClientGui.
@Override
public Object getClientGui(EntityPlayer player) {
LogisticsTileGenericPipe bPipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
if (!(bPipe.pipe instanceof CoreRoutedPipe)) {
return null;
}
List<DoubleCoordinates> list = new WorldCoordinatesWrapper(bPipe).connectedTileEntities().stream().filter(in -> SimpleServiceLocator.pipeInformationManager.isNotAPipe(in.getTileEntity())).map(in -> new DoubleCoordinates(in.getTileEntity())).collect(Collectors.toList());
if (list.isEmpty()) {
list = new WorldCoordinatesWrapper(bPipe).connectedTileEntities().stream().map(in -> new DoubleCoordinates(in.getTileEntity())).collect(Collectors.toList());
}
return new SneakyConfigurationPopup(list, getSlot(player, UpgradeSlot.class));
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class RoutingUpdateDebugClosedSet method readData.
@Override
public void readData(LPDataInput input) {
set = input.readEnumSet(PipeRoutingConnectionType.class);
pos = new DoubleCoordinates(input);
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LogisticsTileGenericSubMultiBlock method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
if (nbt.hasKey("MainPipePos_xPos")) {
mainPipePos.clear();
DoubleCoordinates pos = DoubleCoordinates.readFromNBT("MainPipePos_", nbt);
if (pos != null) {
mainPipePos.add(pos);
}
}
if (nbt.hasKey("MainPipePosList")) {
NBTTagList list = nbt.getTagList("MainPipePosList", new NBTTagCompound().getId());
for (int i = 0; i < list.tagCount(); i++) {
DoubleCoordinates pos = DoubleCoordinates.readFromNBT("MainPipePos_", list.getCompoundTagAt(i));
if (pos != null) {
mainPipePos.add(pos);
}
}
}
if (nbt.hasKey("SubTypeList")) {
NBTTagList list = nbt.getTagList("SubTypeList", new NBTTagString().getId());
subTypes.clear();
for (int i = 0; i < list.tagCount(); i++) {
String name = list.getStringTagAt(i);
CoreMultiBlockPipe.SubBlockTypeForShare type = CoreMultiBlockPipe.SubBlockTypeForShare.valueOf(name);
if (type != null) {
subTypes.add(type);
}
}
}
mainPipe = null;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates 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 = ItemStackLoader.loadAndFixItemStackFromNBT(nbt);
if (!stack.isEmpty()) {
object = new CCItemIdentifierImplementation(ItemIdentifier.get(stack));
checkType();
}
} else if (type.equals("CCItemIdentifierStackImplementation")) {
ItemStack stack = ItemStackLoader.loadAndFixItemStackFromNBT(nbt);
if (!stack.isEmpty()) {
object = new CCItemIdentifierStackImplementation(ItemIdentifierStack.getFromStack(stack));
checkType();
}
} else if (type.equals("CCItemIdentifierBuilder")) {
ItemStack stack = ItemStackLoader.loadAndFixItemStackFromNBT(nbt);
if (!stack.isEmpty()) {
CCItemIdentifierBuilder builder = new CCItemIdentifierBuilder();
builder.setItemID(Double.valueOf(Item.getIdFromItem(stack.getItem())));
builder.setItemData((double) 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 network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class HSTubeCurve method getConnectedEndTile.
@Override
public TileEntity getConnectedEndTile(EnumFacing output) {
TurnDirection ori = orientation.getRenderOrientation();
if (ori.dir2 == output) {
return container.getTile(output);
}
if (ori.dir1 == output) {
DoubleCoordinates pos = new DoubleCoordinates(-2, 0, 2);
LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
set.add(pos);
orientation.rotatePositions(set);
TileEntity subTile = pos.add(getLPPosition()).getTileEntity(getWorld());
if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
return ((LogisticsTileGenericSubMultiBlock) subTile).getTile(output);
}
}
return null;
}
Aggregations