use of mods.railcraft.api.tracks.ITrackTile in project Railcraft by Railcraft.
the class GridTools method getGridObjectAt.
public static Optional<IElectricGrid> getGridObjectAt(IBlockAccess world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
IElectricGrid gridObject = null;
if (tile instanceof IElectricGrid)
gridObject = (IElectricGrid) tile;
if (tile instanceof ITrackTile) {
ITrackInstance track = ((ITrackTile) tile).getTrackInstance();
if (track instanceof IElectricGrid)
gridObject = (IElectricGrid) track;
}
return Optional.fromNullable(gridObject);
}
Aggregations