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