Search in sources :

Example 1 with Type

use of mcjty.typed.Type in project XNet by McJty.

the class TileEntityRouter method addRoutedConnectors.

public void addRoutedConnectors(Map<SidedConsumer, IConnectorSettings> connectors, @Nonnull BlockPos controllerPos, int channel, IChannelType type) {
    if (inError()) {
        // We are in error. Don't do anything
        return;
    }
    LocalChannelId id = new LocalChannelId(controllerPos, channel);
    String publishedName = publishedChannels.get(id);
    if (publishedName != null && !publishedName.isEmpty()) {
        NetworkId networkId = findRoutingNetwork();
        if (networkId != null) {
            LogicTools.consumers(getWorld(), networkId).forEach(consumerPos -> LogicTools.routers(getWorld(), consumerPos).forEach(router -> router.addConnectorsFromConnectedNetworks(connectors, publishedName, type)));
        } else {
            // If there is no routing network that means we have a local network only
            addConnectorsFromConnectedNetworks(connectors, publishedName, type);
        }
    }
}
Also used : GeneralConfiguration(mcjty.xnet.config.GeneralConfiguration) java.util(java.util) SPacketUpdateTileEntity(net.minecraft.network.play.server.SPacketUpdateTileEntity) IConnectorSettings(mcjty.xnet.api.channels.IConnectorSettings) Constants(net.minecraftforge.common.util.Constants) 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) NBTTagList(net.minecraft.nbt.NBTTagList) Type(mcjty.typed.Type) ControllerChannelClientInfo(mcjty.xnet.clientinfo.ControllerChannelClientInfo) GenericTileEntity(mcjty.lib.entity.GenericTileEntity) XNetBlobData(mcjty.xnet.multiblock.XNetBlobData) WorldBlob(mcjty.xnet.multiblock.WorldBlob) Nonnull(javax.annotation.Nonnull) Nullable(javax.annotation.Nullable) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) LogicTools(mcjty.xnet.logic.LogicTools) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) Argument(mcjty.lib.network.Argument) MAX_CHANNELS(mcjty.xnet.logic.ChannelInfo.MAX_CHANNELS) IChannelType(mcjty.xnet.api.channels.IChannelType) NetworkId(mcjty.xnet.api.keys.NetworkId) NetworkId(mcjty.xnet.api.keys.NetworkId)

Aggregations

java.util (java.util)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 GenericTileEntity (mcjty.lib.entity.GenericTileEntity)1 Argument (mcjty.lib.network.Argument)1 BlockPosTools (mcjty.lib.varia.BlockPosTools)1 Type (mcjty.typed.Type)1 IChannelType (mcjty.xnet.api.channels.IChannelType)1 IConnectorSettings (mcjty.xnet.api.channels.IConnectorSettings)1 NetworkId (mcjty.xnet.api.keys.NetworkId)1 SidedConsumer (mcjty.xnet.api.keys.SidedConsumer)1 ControllerChannelClientInfo (mcjty.xnet.clientinfo.ControllerChannelClientInfo)1 GeneralConfiguration (mcjty.xnet.config.GeneralConfiguration)1 ChannelInfo (mcjty.xnet.logic.ChannelInfo)1 MAX_CHANNELS (mcjty.xnet.logic.ChannelInfo.MAX_CHANNELS)1 LogicTools (mcjty.xnet.logic.LogicTools)1 WorldBlob (mcjty.xnet.multiblock.WorldBlob)1 XNetBlobData (mcjty.xnet.multiblock.XNetBlobData)1 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1