Search in sources :

Example 6 with ProcessorTileEntity

use of mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity in project RFToolsControl by McJty.

the class VectorArtScreenModule method getData.

@Override
public ModuleDataVectorArt 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;
    }
    TileEntity te = world.getTileEntity(coordinate);
    if (te instanceof ProcessorTileEntity) {
        ProcessorTileEntity processor = (ProcessorTileEntity) te;
        return new ModuleDataVectorArt(processor.getGfxOps(), processor.getOrderedOps());
    }
    return null;
}
Also used : ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) ModuleDataVectorArt(mcjty.rftoolscontrol.rftoolssupport.ModuleDataVectorArt) Block(net.minecraft.block.Block) World(net.minecraft.world.World)

Example 7 with ProcessorTileEntity

use of mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity in project RFToolsControl by McJty.

the class VectorArtScreenModule method mouseClick.

@Override
public void mouseClick(World world, int x, int y, boolean clicked, EntityPlayer player) {
    int xoffset = 0;
    if (x >= xoffset) {
        if (coordinate.getY() != -1) {
            if (!WorldTools.chunkLoaded(world, coordinate)) {
                return;
            }
            Block block = world.getBlockState(coordinate).getBlock();
            if (block != ModBlocks.processorBlock) {
                return;
            }
            if (clicked) {
                TileEntity te = world.getTileEntity(coordinate);
                if (te instanceof ProcessorTileEntity) {
                    ProcessorTileEntity processor = (ProcessorTileEntity) te;
                    processor.signal(new Tuple(x, y + 7));
                }
            }
        } else if (player != null) {
            player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Module is not linked to a processor!"), false);
        }
    }
}
Also used : ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) Block(net.minecraft.block.Block) Tuple(mcjty.rftoolscontrol.api.parameters.Tuple) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 8 with ProcessorTileEntity

use of mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity in project RFToolsControl by McJty.

the class ConsoleScreenModule method getData.

@Override
public ModuleDataLog 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;
    }
    TileEntity te = world.getTileEntity(coordinate);
    if (te instanceof ProcessorTileEntity) {
        ProcessorTileEntity processor = (ProcessorTileEntity) te;
        List<String> lastMessages = processor.getLastMessages(12);
        return new ModuleDataLog(lastMessages);
    }
    return null;
}
Also used : ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) ModuleDataLog(mcjty.rftoolscontrol.rftoolssupport.ModuleDataLog) Block(net.minecraft.block.Block) World(net.minecraft.world.World)

Example 9 with ProcessorTileEntity

use of mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity in project RFToolsControl by McJty.

the class NodeTileEntity method setPowerInput.

@Override
public void setPowerInput(int powered) {
    if (powerLevel != powered) {
        if (processor != null) {
            TileEntity te = getWorld().getTileEntity(processor);
            if (te instanceof ProcessorTileEntity) {
                ProcessorTileEntity processorTileEntity = (ProcessorTileEntity) te;
                processorTileEntity.redstoneNodeChange(prevIn, powered, node);
            }
        }
        prevIn = powered;
    }
    super.setPowerInput(powered);
}
Also used : ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) GenericTileEntity(mcjty.lib.entity.GenericTileEntity) ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity)

Example 10 with ProcessorTileEntity

use of mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity in project RFToolsControl by McJty.

the class InteractionScreenModule method mouseClick.

@Override
public void mouseClick(World world, int x, int y, boolean clicked, EntityPlayer player) {
    int xoffset;
    if (!line.isEmpty()) {
        xoffset = 80;
    } else {
        xoffset = 5;
    }
    if (x >= xoffset) {
        if (coordinate.getY() != -1) {
            if (!WorldTools.chunkLoaded(world, coordinate)) {
                return;
            }
            Block block = world.getBlockState(coordinate).getBlock();
            if (block != ModBlocks.processorBlock) {
                return;
            }
            if (clicked) {
                TileEntity te = world.getTileEntity(coordinate);
                if (te instanceof ProcessorTileEntity) {
                    ProcessorTileEntity processor = (ProcessorTileEntity) te;
                    processor.signal(signal);
                }
            }
        } else if (player != null) {
            player.sendStatusMessage(new TextComponentString(TextFormatting.RED + "Module is not linked to a processor!"), false);
        }
    }
}
Also used : ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) ProcessorTileEntity(mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity) Block(net.minecraft.block.Block) TextComponentString(net.minecraft.util.text.TextComponentString)

Aggregations

ProcessorTileEntity (mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity)12 TileEntity (net.minecraft.tileentity.TileEntity)11 GenericTileEntity (mcjty.lib.entity.GenericTileEntity)5 Block (net.minecraft.block.Block)5 ItemStack (net.minecraft.item.ItemStack)5 ItemStackList (mcjty.lib.varia.ItemStackList)4 BlockPos (net.minecraft.util.math.BlockPos)4 World (net.minecraft.world.World)3 TextComponentString (net.minecraft.util.text.TextComponentString)2 Parameter (mcjty.rftoolscontrol.api.parameters.Parameter)1 Tuple (mcjty.rftoolscontrol.api.parameters.Tuple)1 CraftingCardItem (mcjty.rftoolscontrol.items.craftingcard.CraftingCardItem)1 PacketGraphicsReady (mcjty.rftoolscontrol.network.PacketGraphicsReady)1 ModuleDataLog (mcjty.rftoolscontrol.rftoolssupport.ModuleDataLog)1 ModuleDataVariable (mcjty.rftoolscontrol.rftoolssupport.ModuleDataVariable)1 ModuleDataVectorArt (mcjty.rftoolscontrol.rftoolssupport.ModuleDataVectorArt)1