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());
}
}
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));
}
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);
}
Aggregations