How to not use PacketDataSerializer?
Th0rgal opened this issue ยท 2 comments
Make sure you're doing the following
- You're using the latest build for your server version
- This isn't an issue caused by another plugin
- You've checked for duplicate issues
- You didn't use
/reload
Describe the question
A clear and concise description of what your question is.
Hey,
For a CustomPayload packet I am using PacketDataSerializer class from NMS:
packetContainer.getModifier().write(1,
new PacketDataSerializer(Unpooled.wrappedBuffer(out.toByteArray())));
Is there a way to do it without NMS?
API method(s) used
List what API method(s) you're using
I'm not, I would like to.
Expected behavior
A clear and concise description of what you expected to happen.
Be able to Serialize a packet without NMS.
Code
If applicable, add relevant code from your project
packetContainer.getModifier().write(1,
new PacketDataSerializer(Unpooled.wrappedBuffer(out.toByteArray())));
Additional context
This is not a normal CustomPayload containing message for bungee, it's a packet sent for forge. The current way with PacketDataSerializer works well but requires NMS.
See if StreamSerializer works for what you need: https://ci.dmulloy2.net/job/ProtocolLib/javadoc/com/comphenix/protocol/utility/StreamSerializer.html