Search in sources :

Example 1 with IModuleDataString

use of mcjty.rftools.api.screens.data.IModuleDataString in project RFTools by McJty.

the class MachineInformationScreenModule method getData.

@Override
public IModuleDataString getData(IScreenDataHelper helper, World worldObj, long millis) {
    World world = DimensionManager.getWorld(dim);
    if (world == null) {
        return null;
    }
    if (!RFToolsTools.chunkLoaded(world, coordinate)) {
        return null;
    }
    TileEntity te = world.getTileEntity(coordinate);
    if (!(te instanceof MachineInformation)) {
        return null;
    }
    MachineInformation information = (MachineInformation) te;
    String info;
    if (tag < 0 || tag >= information.getTagCount()) {
        info = "[BAD TAG]";
    } else {
        info = information.getData(tag, millis);
    }
    return helper.createString(info);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) MachineInformation(mcjty.lib.api.MachineInformation) IModuleDataString(mcjty.rftools.api.screens.data.IModuleDataString) World(net.minecraft.world.World)

Aggregations

MachineInformation (mcjty.lib.api.MachineInformation)1 IModuleDataString (mcjty.rftools.api.screens.data.IModuleDataString)1 TileEntity (net.minecraft.tileentity.TileEntity)1 World (net.minecraft.world.World)1