use of appeng.api.networking.IGridNode in project LogisticsPipes by RS485.
the class AETankHandler method getBaseTileEntity.
private TileEntity getBaseTileEntity(IGridNode node) {
IGrid grid = node.getGrid();
if (grid == null) {
return null;
}
IGridNode pivot = grid.getPivot();
if (pivot == null) {
return null;
}
IGridBlock block = pivot.getGridBlock();
if (block == null) {
return null;
}
DimensionalCoord coord = block.getLocation();
if (coord == null) {
return null;
}
World world = coord.getWorld();
if (world == null) {
return null;
}
return world.getTileEntity(coord.x, coord.y, coord.z);
}
use of appeng.api.networking.IGridNode in project LogisticsPipes by RS485.
the class AETankHandler method getBaseTilesFor.
@Override
public List<TileEntity> getBaseTilesFor(TileEntity tile) {
List<TileEntity> tiles = new ArrayList<>(1);
if (tile instanceof IGridHost) {
IGridHost host = (IGridHost) tile;
IGridNode node = host.getGridNode(ForgeDirection.UNKNOWN);
if (node != null) {
TileEntity base = getBaseTileEntity(node);
if (base != null) {
tiles.add(base);
return tiles;
}
}
}
tiles.add(tile);
return tiles;
}
Aggregations