use of mcjty.xnet.multiblock.XNetBlobData in project XNet by McJty.
the class GenericCableBlock method unlinkBlock.
public void unlinkBlock(World world, BlockPos pos) {
if (!world.isRemote) {
XNetBlobData blobData = XNetBlobData.getBlobData(world);
WorldBlob worldBlob = blobData.getWorldBlob(world);
worldBlob.removeCableSegment(pos);
blobData.save(world);
}
}
use of mcjty.xnet.multiblock.XNetBlobData in project XNet by McJty.
the class RouterBlock method addProbeInfo.
@Override
@Optional.Method(modid = "theoneprobe")
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
XNetBlobData blobData = XNetBlobData.getBlobData(world);
WorldBlob worldBlob = blobData.getWorldBlob(world);
Set<NetworkId> networks = worldBlob.getNetworksAt(data.getPos());
for (NetworkId networkId : networks) {
probeInfo.text(TextStyleClass.LABEL + "Network: " + TextStyleClass.INFO + networkId.getId());
if (mode != ProbeMode.EXTENDED) {
break;
}
}
TileEntity te = world.getTileEntity(data.getPos());
if (te instanceof TileEntityRouter) {
TileEntityRouter router = (TileEntityRouter) te;
if (router.inError()) {
probeInfo.text(TextStyleClass.ERROR + "Too many channels on router!");
} else {
probeInfo.text(TextStyleClass.LABEL + "Channels: " + TextStyleClass.INFO + router.getChannelCount());
}
}
if (mode == ProbeMode.DEBUG) {
BlobId blobId = worldBlob.getBlobAt(data.getPos());
if (blobId != null) {
probeInfo.text(TextStyleClass.LABEL + "Blob: " + TextStyleClass.INFO + blobId.getId());
}
ColorId colorId = worldBlob.getColorAt(data.getPos());
if (colorId != null) {
probeInfo.text(TextStyleClass.LABEL + "Color: " + TextStyleClass.INFO + colorId.getId());
}
}
}
use of mcjty.xnet.multiblock.XNetBlobData 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);
}
}
use of mcjty.xnet.multiblock.XNetBlobData 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);
}
use of mcjty.xnet.multiblock.XNetBlobData in project XNet by McJty.
the class ConnectorBlock method createCableSegment.
@Override
public void createCableSegment(World world, BlockPos pos, ItemStack stack) {
ConsumerId consumer;
if (!stack.isEmpty() && stack.hasTagCompound() && stack.getTagCompound().hasKey("consumerId")) {
consumer = new ConsumerId(stack.getTagCompound().getInteger("consumerId"));
} else {
XNetBlobData blobData = XNetBlobData.getBlobData(world);
WorldBlob worldBlob = blobData.getWorldBlob(world);
consumer = worldBlob.newConsumer();
}
createCableSegment(world, pos, consumer);
}
Aggregations