Patbox / sgui

Library for creating custom, server side guis on Fabric
GNU Lesser General Public License v3.0
83 stars 16 forks source link

Fix cyclical packets with HotbarGui#onSelectedSlotChange #36

Closed senseiwells closed 1 week ago

senseiwells commented 1 week ago

When a player selects a slot when using the HotbarGui the HotbarGui would send the client back a packet, when scrolling this would cause the client and server to be stuck in an endless loop of trying to sync each other up.

This fixes the issue by not sending the client the packet when they update the slot on the server.

Unsure about the api implementation, the method should probably be marked with @OverrideOnly or @Internal with a separate protected method provided, to avoid people accidentally calling onSelectedSlotChange instead of setSelectedSlot