Search in sources :

Example 1 with ModuleDataVariable

use of mcjty.rftoolscontrol.rftoolssupport.ModuleDataVariable in project RFToolsControl by McJty.

the class VariableScreenModule method getData.

@Override
public ModuleDataVariable getData(IScreenDataHelper h, World worldObj, long millis) {
    World world = DimensionManager.getWorld(dim);
    if (world == null) {
        return null;
    }
    if (!WorldTools.chunkLoaded(world, coordinate)) {
        return null;
    }
    Block block = world.getBlockState(coordinate).getBlock();
    if (block != ModBlocks.processorBlock) {
        return null;
    }
    if (varIdx < 0 || varIdx >= ProcessorTileEntity.MAXVARS) {
        return null;
    }
    TileEntity te = world.getTileEntity(coordinate);
    if (te instanceof ProcessorTileEntity) {
        ProcessorTileEntity processor = (ProcessorTileEntity) te;
        Parameter parameter = processor.getParameter(varIdx);
        return new ModuleDataVariable(parameter);
    }
    return null;
}
Also used : ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) Block(net.minecraft.block.Block) Parameter(mcjty.rftoolscontrol.api.parameters.Parameter) ModuleDataVariable(mcjty.rftoolscontrol.rftoolssupport.ModuleDataVariable) World(net.minecraft.world.World)

Aggregations

Parameter (mcjty.rftoolscontrol.api.parameters.Parameter)1 ProcessorTileEntity (mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity)1 ModuleDataVariable (mcjty.rftoolscontrol.rftoolssupport.ModuleDataVariable)1 Block (net.minecraft.block.Block)1 TileEntity (net.minecraft.tileentity.TileEntity)1 World (net.minecraft.world.World)1