ARKMessagePipeline.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:ARKCraft-Code 作者:
@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);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号