use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class PipeItemsInvSysConnector method inventoryConnected.
private boolean inventoryConnected() {
for (int i = 0; i < 6; i++) {
ForgeDirection dir = ForgeDirection.values()[i];
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(this), dir);
TileEntity tile = p.getTileEntity(getWorld());
if (tile instanceof IInventory && this.container.canPipeConnect(tile, dir)) {
return true;
}
}
return false;
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class EnderIOHyperCubeConnection method transmit.
@Override
public void transmit(TileEntity tile, IRoutedItem data) {
List<TileEntity> list = getConnections(tile);
if (list.size() < 1) {
return;
}
TileEntity pipe = list.get(0);
if (pipe instanceof LogisticsTileGenericPipe) {
((CoreRoutedPipe) ((LogisticsTileGenericPipe) pipe).pipe).queueUnroutedItemInformation(data.getItemIdentifierStack().clone(), data.getInfo());
} else {
new RuntimeException("Only LP pipes can be next to Tesseracts to queue item information").printStackTrace();
}
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class EnderIOHyperCubeConnection method getConnections.
@Override
public List<TileEntity> getConnections(TileEntity tile) {
boolean onlyOnePipe = false;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(tile), direction);
TileEntity canidate = p.getTileEntity(tile.getWorldObj());
if (canidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(tile, canidate, direction)) {
if (onlyOnePipe) {
onlyOnePipe = false;
break;
} else {
onlyOnePipe = true;
}
}
}
if (!onlyOnePipe || !SimpleServiceLocator.enderIOProxy.isSendAndReceive(tile)) {
return new ArrayList<>(0);
}
List<? extends TileEntity> connections = SimpleServiceLocator.enderIOProxy.getConnectedHyperCubes(tile);
List<TileEntity> list = new ArrayList<>();
for (TileEntity connected : connections) {
if (!SimpleServiceLocator.enderIOProxy.isSendAndReceive(connected)) {
continue;
}
LogisticsTileGenericPipe pipe = null;
for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS) {
DoubleCoordinates p = CoordinateUtils.add(new DoubleCoordinates(connected), direction);
TileEntity canidate = p.getTileEntity(tile.getWorldObj());
if (canidate instanceof LogisticsTileGenericPipe && MainProxy.checkPipesConnections(connected, canidate, direction)) {
if (pipe != null) {
pipe = null;
break;
} else {
pipe = (LogisticsTileGenericPipe) canidate;
}
}
}
if (pipe != null && pipe.pipe instanceof CoreRoutedPipe) {
list.add(pipe);
}
}
if (list.size() == 1) {
return list;
} else {
return new ArrayList<>(0);
}
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class HSTubeCurve method getConnectedEndTile.
@Override
public TileEntity getConnectedEndTile(ForgeDirection 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;
}
use of net.minecraft.tileentity.TileEntity in project LogisticsPipes by RS485.
the class HSTubeSpeedup method getConnectedEndTile.
@Override
public TileEntity getConnectedEndTile(ForgeDirection output) {
if (orientation.dir1 == output) {
DoubleCoordinates pos = new DoubleCoordinates(0, 0, -3);
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);
}
} else if (orientation.dir1.getOpposite() == output) {
return container.getTile(output);
}
return null;
}
Aggregations