Search in sources :

Example 1 with Tuple

use of mcjty.rftoolscontrol.api.parameters.Tuple in project RFToolsControl by McJty.

the class TupleEditor method writeConstantValue.

@Override
protected void writeConstantValue(ParameterValue value) {
    if (value == null || value.getValue() == null) {
        fieldX.setText("");
        fieldY.setText("");
    } else {
        Tuple tuple = (Tuple) value.getValue();
        try {
            fieldX.setText(Integer.toString(tuple.getX()));
            fieldY.setText(Integer.toString(tuple.getY()));
        } catch (Exception e) {
            fieldX.setText("");
            fieldY.setText("");
        }
    }
}
Also used : Tuple(mcjty.rftoolscontrol.api.parameters.Tuple)

Example 2 with Tuple

use of mcjty.rftoolscontrol.api.parameters.Tuple 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 3 with Tuple

use of mcjty.rftoolscontrol.api.parameters.Tuple in project RFToolsControl by McJty.

the class TupleEditor method readConstantValue.

@Override
protected ParameterValue readConstantValue() {
    Integer x = parseIntSafe(fieldX.getText());
    Integer y = parseIntSafe(fieldY.getText());
    return ParameterValue.constant(new Tuple(x == null ? 0 : x, y == null ? 0 : y));
}
Also used : Tuple(mcjty.rftoolscontrol.api.parameters.Tuple)

Aggregations

Tuple (mcjty.rftoolscontrol.api.parameters.Tuple)3 ProcessorTileEntity (mcjty.rftoolscontrol.blocks.processor.ProcessorTileEntity)1 Block (net.minecraft.block.Block)1 TileEntity (net.minecraft.tileentity.TileEntity)1 TextComponentString (net.minecraft.util.text.TextComponentString)1