@Override public void encodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOException { ByteBufOutputStream bos = new ByteBufOutputStream(buffer); bos.writeInt(x); bos.writeInt(y); bos.writeInt(z); NBTHelper.nbtWrite(tag, bos); }
@Override public void decodeInto(ChannelHandlerContext ctx, ByteBuf buffer) throws IOException { ByteBufInputStream bis = new ByteBufInputStream(buffer); x = bis.readInt(); y = bis.readInt(); z = bis.readInt(); DataInputStream dis = new DataInputStream(bis); tag = NBTHelper.nbtRead(dis); }