WesJD / AnvilGUI

Capture user input in Minecraft through an anvil GUI in under 20 lines of code
MIT License
466 stars 111 forks source link

Send experience packets to support Bedrock via Geyser #337

Closed PikaMug closed 2 weeks ago

PikaMug commented 3 weeks ago

Fixes #332

Bedrock does not allow the result slot to be clicked when the player's experience level is 0. This change sends a packet which sets the Bedrock client's level to 20 (number is trivial) on anvil open, and then again back to the actual value when closed. It adds a .gesyer-compat(boolean) to the builder, which is enabled by default. A second constructor has been added to AnvilGUI for backwards compatibility.

In writing this, it occurs to me it may be preferred to have the method be something like .disableGeyserCompat() instead, to match .preventClose(). Let me know if that's what you'd prefer.

Other changes I made in order to test this:

WesJD commented 2 weeks ago

final thing to do then is just increment the minor version and we're good to merge (1.10.0-SNAPSHOT)

WesJD commented 2 weeks ago

Thank you for your help!