Hello, I'm currently trying to think of ways to combat seed cracking since it's been made relatively popular by hacked clients. Since a few versions, Minecraft now sends the first 8 bits of the seed as a hash to the client in the join game packet and that's how the most popular seed cracker currently searches for the seed. Is it possible to modify that packet? I would imagine it should be possible with ProtocolLib, however, this is my first time working with it, so I'm not sure if it does work or if it would break the client from rendering certain things. Any input or ideas would be appreciated. // EDIT I researched a bit and assume that it's the PacketType.Play.Server.LOGIN packet in protocol lib. Accessing its fields doesn't enlighten me much on how to change a specific part of it though.
Why does the client even need to know that information, seems a bit weird to me. https://wiki.vg/Protocol#Join_Game Could maybe write the packet with ProtocolLib but idk what packet it would be, I thought it would be Play.Server.Login, maybe it is but not sure.
Same. As I posted, I'm already highly positive on which packet it is, I'm just not sure if I can modify it, if so how and finally which consequences it would have on the client. I can test out the last thing myself if no one has any idea, I pretty much just need assistance on the modifying part of it.
Truly weird, I do currently send a seed set to 0 in my project and the client doesn't reject anything. Isn't it possible to catch the join packet before it is sent and change the seed field?
If this helps at all, this is how I change the players level in the XP packet with PLib. Spoiler Code (Text): ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(instance, ListenerPriority.HIGHEST, PacketType.Play.Server.EXPERIENCE) { @Override public void onPacketSending(PacketEvent event) { final Player player = event.getPlayer(); final PacketContainer packet = event.getPacket(); try { // Level will be 12345 packet.getIntegers().write(1, 12345); } catch (final FieldAccessException exception) { exception.printStackTrace(); } event.setPacket(packet); } });
Thanks, that's exactly what I needed. Their wiki didn't describe that at all. Working code: Code (Java): ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Server.LOGIN) { @Override public void onPacketSending(PacketEvent event) { PacketContainer packet = event.getPacket(); try { packet.getLongs().write(0, 0L); } catch (FieldAccessException exception) { exception.printStackTrace(); } event.setPacket(packet); } });
Update: Found one more packet to change. Respawn - ProtocolLib equivalent: PacketType.Play.Server.RESPAWN, code above works for that too. Potentially Update Structure Block too, although that specific case seems a bit too abstract for me. I also made a public resource out of this, just in case. https://www.spigotmc.org/resources/antiseedcracker-1-15-1-16-x.81495/