0

My goal is to instantly get every incoming Minecraft packet as text. I don't care if its JSON, xaml or anything else, as long as I can search trough it with .contains(). I also don't care if this is achieved with a mod loader like forge or an external program. The only limitation is that I only know Java and C#. I have access to the packet object, but I don't know how to convert them.

I have tried Converting the packet object to JSON using Gson.toJson(), but many packets have circular references or other things, that will cause it to fail. I also tried working with the debugger, but I could not find a way to automate that.

pppery
  • 3,731
  • 22
  • 33
  • 46
Janx
  • 1

1 Answers1

1

You can use the same way as minecraft does: Create buffer and put everything in it.

The Packet interface from NMS declare :

void a(PacketDataSerializer paramPacketDataSerializer) throws IOException;
void b(PacketDataSerializer paramPacketDataSerializer) throws IOException;

a read content from serializer

b write content to serializer

You can use the second method to fill the serializer, then you have everything as MC will do to send the packet.

To create serializer, you need to use new PacketDataSerializer(Unpooled.buffer());.

The name of the serializer can be different between versions.

PS: For 1.18 and lower, the Packet interface from NMS declare only

void a(PacketDataSerializer buf);

There isn't any other method using PacketDataSerializer object.

Elikill58
  • 4,050
  • 24
  • 23
  • 45