FMLIndexedMessageToMessageCodec.java 文件源码

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

项目:CustomWorldGen 作者:
@Override
protected final void encode(ChannelHandlerContext ctx, A msg, List<Object> out) throws Exception
{
    PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
    byte discriminator = types.get(msg.getClass());
    buffer.writeByte(discriminator);
    encodeInto(ctx, msg, buffer);
    FMLProxyPacket proxy = new FMLProxyPacket(buffer/*.copy()*/, ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
    WeakReference<FMLProxyPacket> ref = ctx.attr(INBOUNDPACKETTRACKER).get().get();
    FMLProxyPacket old = ref == null ? null : ref.get();
    if (old != null)
    {
        proxy.setDispatcher(old.getDispatcher());
    }
    out.add(proxy);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号