NeoForge
NeoForge copied to clipboard
Flight Attribute doesn't properly sync to client `flying`
Minecraft Version: 1.21.x
NeoForge Version: 21.1.6
Steps to Reproduce:
- Have some form of flight being provided via the attribute that is toggleable.
- Upon starting to fly, toggle the attribute off.
- This should result in the attribute turning off, on the server and
flyingandmayFly; however, because the client seems to getmayFlycorrectly turned off,flyingis still followed through to be true. This causes the player to have flight, but also not be able to disengage said flight until they land potentially killing their character.
An example mod (if needed) to use is Mekanism with the gravity module in the chest piece. Spam space and the flight toggle (which is typically G I believe). You should wind up in a state where flying is true and mayFly is false on the server
Description of issue:
This might be a timing issue, but the client is setting the flying to true, AFTER the server has turned everything off.
Seemingly, adding the following after the existing code in ServerGamePacketListenerImpl in handlePlayerAbilities might be enough, at least from testing I've done.
if (packet.isFlying() != this.player.getAbilities().flying)
player.onUpdateAbilities();