-
Bug
-
Resolution: Duplicate
-
None
-
24w06a
-
None
-
Confirmed
-
Commands
Setting the generic.gravity attribute of an entity to a value <= 0.0030612244302160993 (~ 3/980) will make them unable to fall without downwards momentum to start with and forces their OnGround tag to be false, even when the entity is on the ground. To players, this means that you can't jump and have inertia similarly to flying in creative mode.
Steps to reproduce:
- Set your generic.gravity attribute to a value below 0.0030612244302160993, e.g. 0.003:
/attribute @s minecraft:generic.gravity base set 0.003
- Go onto the ground and check your OnGround tag:
/data get entity @s OnGround
- Try to move around and jump
- Go into creative mode and fly into the air and then stop flying.
Expected behavior:
- The OnGround tag should be true (1b).
- You should be able to move around without inertia and jump.
- You should be able to fall while in the air.
Actual behavior:
- The OnGround tag is false (0b).
- You feel a lot of inertia while moving, similarly to flying in creative mode
- You stay in the air and can't fall down.
Code analysis:
public void aiStep() { // ... if (!isEffectiveAi()) { setDeltaMovement(getDeltaMovement().scale(0.98)); // Line 2713 } // ... if (Math.abs(motion.x) < 0.003) { // Line 2724 xMotion = 0; } if (Math.abs(motion.y) < 0.003) { yMotion = 0; } if (Math.abs(motion.z) < 0.003) { zMotion = 0; } // ... }
The motion of the entity is first multiplied by 0.98 and if the result in a particular direction turns out to be less than 0.003, the motion in that direction is removed. If this happens to be the negative y direction, the falling gets negated.
Potential fix:
Disable the cut-off for the y direction if the entity has gravity:
if (Math.abs(motion.y) < 0.003 && getGravity() == 0) { yMotion = 0; }
- duplicates
-
MC-268379 The lowest positive value for Gravity that can be entered that will still allow the player to jump is 0.0030612244302160997
- Resolved