garbagemule / MobArena

MobArena plugin for Minecraft
GNU General Public License v3.0
195 stars 151 forks source link

Reset player fall-distance on select teleports. #708

Closed sepulzera closed 2 years ago

sepulzera commented 2 years ago

Sets the player fall-distance to zero before performing a player teleport during "move player" steps. This should cancel out any already calculated, added fall-distance that might result in unintentional fall damage.

Fixes #698

Summary

Problem

Solution

Your attempt with resetting the velocity was a good first step, but not sufficient. After a quick google-search, I found some other examples that also resetted the fall-distance. (Like https://www.tabnine.com/web/assistant/code/rs/5c65732f1095a50001513a9a#L1830)

The combination of resetting both the velocity and fall-distance seems to work. No single death after 20 attempts.

Action

Feel free to squash my commit with your previous one. I guess there is no need for keeping both commits/commit-messages.

garbagemule commented 2 years ago

I've merged this in manually to get things rolling. Thanks Frank!