Search in sources :

Example 6 with ColorId

use of mcjty.xnet.multiblock.ColorId in project XNet by McJty.

the class RouterBlock method onBlockPlacedBy.

@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
    super.onBlockPlacedBy(world, pos, state, placer, stack);
    if (!world.isRemote) {
        XNetBlobData blobData = XNetBlobData.getBlobData(world);
        WorldBlob worldBlob = blobData.getWorldBlob(world);
        NetworkId networkId = worldBlob.newNetwork();
        worldBlob.createNetworkProvider(pos, new ColorId(CableColor.ROUTING.ordinal() + 1), networkId);
        blobData.save(world);
    }
}
Also used : XNetBlobData(mcjty.xnet.multiblock.XNetBlobData) WorldBlob(mcjty.xnet.multiblock.WorldBlob) NetworkId(mcjty.xnet.api.keys.NetworkId) ColorId(mcjty.xnet.multiblock.ColorId)

Example 7 with ColorId

use of mcjty.xnet.multiblock.ColorId in project XNet by McJty.

the class ConnectorBlock method createCableSegment.

public void createCableSegment(World world, BlockPos pos, ConsumerId consumer) {
    XNetBlobData blobData = XNetBlobData.getBlobData(world);
    WorldBlob worldBlob = blobData.getWorldBlob(world);
    CableColor color = world.getBlockState(pos).getValue(COLOR);
    worldBlob.createNetworkConsumer(pos, new ColorId(color.ordinal() + 1), consumer);
    blobData.save(world);
}
Also used : XNetBlobData(mcjty.xnet.multiblock.XNetBlobData) WorldBlob(mcjty.xnet.multiblock.WorldBlob) CableColor(mcjty.xnet.blocks.generic.CableColor) ColorId(mcjty.xnet.multiblock.ColorId)

Aggregations

ColorId (mcjty.xnet.multiblock.ColorId)7 WorldBlob (mcjty.xnet.multiblock.WorldBlob)7 NetworkId (mcjty.xnet.api.keys.NetworkId)5 XNetBlobData (mcjty.xnet.multiblock.XNetBlobData)5 BlobId (mcjty.xnet.multiblock.BlobId)3 TileEntity (net.minecraft.tileentity.TileEntity)3 ConsumerId (mcjty.xnet.api.keys.ConsumerId)1 ConnectorBlock (mcjty.xnet.blocks.cables.ConnectorBlock)1 CableColor (mcjty.xnet.blocks.generic.CableColor)1 EnumFacing (net.minecraft.util.EnumFacing)1