Search in sources :

Example 6 with FMLEmbeddedChannel

use of net.minecraftforge.fml.common.network.FMLEmbeddedChannel in project LogisticsPipes by RS485.

the class MainProxy method createChannels.

public static void createChannels() {
    MainProxy.channels = NetworkRegistry.INSTANCE.newChannel(MainProxy.networkChannelName, new PacketHandler());
    for (Side side : Side.values()) {
        FMLEmbeddedChannel channel = MainProxy.channels.get(side);
        String type = channel.findChannelHandlerNameForType(PacketHandler.class);
        channel.pipeline().addAfter(type, PacketInboundHandler.class.getName(), new PacketInboundHandler());
    }
}
Also used : Side(net.minecraftforge.fml.relauncher.Side) PacketHandler(logisticspipes.network.PacketHandler) PacketInboundHandler(logisticspipes.network.PacketInboundHandler) FMLEmbeddedChannel(net.minecraftforge.fml.common.network.FMLEmbeddedChannel)

Example 7 with FMLEmbeddedChannel

use of net.minecraftforge.fml.common.network.FMLEmbeddedChannel in project Galacticraft by micdoodle8.

the class PacketCustom method assignHandshakeHandler.

public static void assignHandshakeHandler(Object channelKey, IHandshakeHandler handler) {
    FMLEmbeddedChannel channel = getOrCreateChannel(channelName(channelKey), Side.SERVER);
    channel.pipeline().addLast(new HandshakeInboundHandler(handler));
}
Also used : FMLEmbeddedChannel(net.minecraftforge.fml.common.network.FMLEmbeddedChannel)

Example 8 with FMLEmbeddedChannel

use of net.minecraftforge.fml.common.network.FMLEmbeddedChannel in project SpongeForge by SpongePowered.

the class SpongeIndexedMessageChannel method addHandlerForSide.

private <M extends Message> void addHandlerForSide(Platform.Type side, Class<M> messageClass, MessageHandler<M> handler) {
    FMLEmbeddedChannel channel = this.channels.get(side.isClient() ? Side.CLIENT : Side.SERVER);
    String type = channel.findChannelHandlerNameForType(SpongeMessageCodec.class);
    SpongeMessageInboundHandler<M> channelHandler = new SpongeMessageInboundHandler<>(handler, messageClass, side);
    channel.pipeline().addAfter(type, handler.getClass().getName(), channelHandler);
}
Also used : FMLEmbeddedChannel(net.minecraftforge.fml.common.network.FMLEmbeddedChannel)

Aggregations

FMLEmbeddedChannel (net.minecraftforge.fml.common.network.FMLEmbeddedChannel)8 Side (net.minecraftforge.fml.relauncher.Side)2 PacketHandler (logisticspipes.network.PacketHandler)1 PacketInboundHandler (logisticspipes.network.PacketInboundHandler)1 ForgeMessage (net.minecraftforge.common.network.ForgeMessage)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1 IMixinEntityPlayerMP (org.spongepowered.common.interfaces.entity.player.IMixinEntityPlayerMP)1