Search in sources :

Example 1 with ITrackTile

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);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ITrackTile(mods.railcraft.api.tracks.ITrackTile) ITrackInstance(mods.railcraft.api.tracks.ITrackInstance)

Aggregations

ITrackInstance (mods.railcraft.api.tracks.ITrackInstance)1 ITrackTile (mods.railcraft.api.tracks.ITrackTile)1 TileEntity (net.minecraft.tileentity.TileEntity)1