@Override
protected void encode(ChannelHandlerContext ctx, ARKMessage msg, List<Object> out) throws Exception
{
ByteBuf buffer = Unpooled.buffer();
Class<? extends ARKMessage> clazz = msg.getClass();
if (!packets.contains(msg.getClass())) { throw new NullPointerException("No Packet Registered for: " + msg
.getClass().getCanonicalName()); }
byte discriminator = (byte) packets.indexOf(clazz);
buffer.writeByte(discriminator);
msg.encodeInto(ctx, buffer);
FMLProxyPacket proxyPacket = new FMLProxyPacket((PacketBuffer) buffer, ctx.channel().attr(
NetworkRegistry.FML_CHANNEL).get());
out.add(proxyPacket);
}
ARKMessagePipeline.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:ARKCraft
作者:
评论列表
文章目录