Zergatul/cheatutils

NoFall not applying in circumstances of disabling Fly (Forge 1.18.2 Version 0.10)

Closed this issue · 3 comments

Replication:
Step 1: Enable Fly
Step 2: Fly upwards a large enough arbitrary number (~10)
Step 3: Descend with crouch key most of the way
Step 4: Disable Fly
Result: Fall damage likely equivalent to the sum of distance traveled downwards.
Note: Fall damage is not negated by NoFall
Another interesting phenomenon is that you will die immediately even if NoFall is enabled, and you are above an ocean provided you have built up enough "potential energy". You die before even touching the ocean in mid air as well.

This bug can result in instadeath if Fly is not used carefully. Pretty sure this is a common bug with fly hacks and likely a difficult fix.

Is this vanilla server behavior? I cannot reproduce this in singleplayer 1.18, but I can in 1.19.

From code perspective fly hack is pretty simple. I just set flag in player abilities that is responsible to flying. Client thinks server allowed it to fly. This is how very first version of fly hack worked. After testing this on some server I noticed as soon as I touch surface (with fly still enabled) I receive a ton of damage. I fixed this by adjusting MovePlayerPacket. It has flag onGround. I added code to always send onGround=false while fly hack is enabled. This fixed instadeath when touching surface.

No Fall messes up with the same packet, and with the same onGround flag. If you are moving downwards faster than 0.5 blocks/tick, it sets onGround=true in all packets. I think this 2 modules can conflict with each other, and if you are descending while in fly, No Fall module can set onGround=true and custom server can skip actual check for block on your feet and just calculate fall damage. Did you override fly speed? If yes, what its value?

I think I can disable No Fall while fly hack is enabled. Also I can send MovePlayerPacket with onGround=true as soon as fly hack is turned off. Not sure if this will fix all cases. As you can see, if you fly high enough, move down, and disable fly hack close to surface, you are not getting enough fall speed for No Fall module to turn on.

Updated: I was able to reproduce in 1.18, not sure why it is not as consistent as in 1.19 for me.

I did some research:

  • you should better disable no fall while using fly for now (I will do this automatically in next versions)
  • if you want to negate fall damage before exiting fly: fly to the surface, fly up a bit (even half a block is enough), turn off fly.

When server sees you are moving upwards it sets fall distance to zero. I was trying to automate this by constantly performing micro-jumps in background (for 0.0001 height), but for some reasons it doesn't work reliably

I have been being careful with Fly but I haven't been using it with NoFall and there hasn't been any issues. You are wonderful.