Search in sources :

Example 21 with NetworkId

use of mcjty.xnet.api.keys.NetworkId in project XNet by McJty.

the class TileEntityController method getNetworkChecker.

@Nonnull
public NetworkChecker getNetworkChecker() {
    if (networkChecker == null) {
        networkChecker = new NetworkChecker();
        networkChecker.add(networkId);
        WorldBlob worldBlob = XNetBlobData.getBlobData(getWorld()).getWorldBlob(getWorld());
        LogicTools.routers(getWorld(), networkId).forEach(router -> {
            networkChecker.add(worldBlob.getNetworksAt(router.getPos()));
            // We're only interested in one network. The other router networks are all same topology
            NetworkId routerNetwork = worldBlob.getNetworkAt(router.getPos());
            if (routerNetwork != null) {
                LogicTools.routers(getWorld(), routerNetwork).filter(r -> router != r).forEach(r -> LogicTools.connectors(getWorld(), r.getPos()).forEach(connectorPos -> networkChecker.add(worldBlob.getNetworkAt(connectorPos))));
            }
        });
    // networkChecker.dump();
    }
    return networkChecker;
}
Also used : GeneralConfiguration(mcjty.xnet.config.GeneralConfiguration) java.util(java.util) SPacketUpdateTileEntity(net.minecraft.network.play.server.SPacketUpdateTileEntity) ConnectorTileEntity(mcjty.xnet.blocks.cables.ConnectorTileEntity) ChannelClientInfo(mcjty.xnet.clientinfo.ChannelClientInfo) IConnectorSettings(mcjty.xnet.api.channels.IConnectorSettings) ConnectorClientInfo(mcjty.xnet.clientinfo.ConnectorClientInfo) SidedConsumer(mcjty.xnet.api.keys.SidedConsumer) ChannelInfo(mcjty.xnet.logic.ChannelInfo) NetworkManager(net.minecraft.network.NetworkManager) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) BlockPosTools(mcjty.lib.varia.BlockPosTools) ItemStack(net.minecraft.item.ItemStack) Type(mcjty.typed.Type) NetworkChecker(mcjty.xnet.multiblock.NetworkChecker) ITickable(net.minecraft.util.ITickable) XNetBlobData(mcjty.xnet.multiblock.XNetBlobData) WorldBlob(mcjty.xnet.multiblock.WorldBlob) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ConsumerId(mcjty.xnet.api.keys.ConsumerId) GenericEnergyReceiverTileEntity(mcjty.lib.entity.GenericEnergyReceiverTileEntity) IControllerContext(mcjty.xnet.api.channels.IControllerContext) World(net.minecraft.world.World) ConnectorInfo(mcjty.xnet.clientinfo.ConnectorInfo) GuiController(mcjty.xnet.blocks.controller.gui.GuiController) LogicTools(mcjty.xnet.logic.LogicTools) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) XNet(mcjty.xnet.XNet) IBlockState(net.minecraft.block.state.IBlockState) Argument(mcjty.lib.network.Argument) NetCableSetup(mcjty.xnet.blocks.cables.NetCableSetup) MAX_CHANNELS(mcjty.xnet.logic.ChannelInfo.MAX_CHANNELS) IChannelType(mcjty.xnet.api.channels.IChannelType) ConnectedBlockClientInfo(mcjty.xnet.clientinfo.ConnectedBlockClientInfo) ConnectorBlock(mcjty.xnet.blocks.cables.ConnectorBlock) TileEntity(net.minecraft.tileentity.TileEntity) SidedPos(mcjty.xnet.api.keys.SidedPos) NetworkId(mcjty.xnet.api.keys.NetworkId) WorldBlob(mcjty.xnet.multiblock.WorldBlob) NetworkId(mcjty.xnet.api.keys.NetworkId) NetworkChecker(mcjty.xnet.multiblock.NetworkChecker) Nonnull(javax.annotation.Nonnull)

Aggregations

NetworkId (mcjty.xnet.api.keys.NetworkId)21 WorldBlob (mcjty.xnet.multiblock.WorldBlob)10 ConsumerId (mcjty.xnet.api.keys.ConsumerId)7 XNetBlobData (mcjty.xnet.multiblock.XNetBlobData)6 EnumFacing (net.minecraft.util.EnumFacing)6 ColorId (mcjty.xnet.multiblock.ColorId)5 Nonnull (javax.annotation.Nonnull)4 Nullable (javax.annotation.Nullable)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 TileEntity (net.minecraft.tileentity.TileEntity)4 BlockPos (net.minecraft.util.math.BlockPos)4 java.util (java.util)3 Argument (mcjty.lib.network.Argument)3 BlockPosTools (mcjty.lib.varia.BlockPosTools)3 Type (mcjty.typed.Type)3 IChannelType (mcjty.xnet.api.channels.IChannelType)3 IConnectorSettings (mcjty.xnet.api.channels.IConnectorSettings)3 SidedConsumer (mcjty.xnet.api.keys.SidedConsumer)3 GeneralConfiguration (mcjty.xnet.config.GeneralConfiguration)3 ChannelInfo (mcjty.xnet.logic.ChannelInfo)3