Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-252141

Small downwards motion applied to player when receiving knockback

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.18.2, 1.19.1
    • None
    • Plausible
    • Player
    • Normal
    • Platform

       

      Within LivingEntity, the travel method applies gravity to all entities after the check

      else if (!this.isNoGravity()) {

      But this is incorrectly(I assume) applied to the player as well, resulting in a small downwards force whenever a player receives a knockback, which gets magnified significantly by the other issue with knockback(see my other issue).

      Proposed solution: add 

      && !(this instanceof Player)

      as an additional check, since player's gravity is handled client side and servers should not worry about it.

       

      P.S. The downwards motion is -0.08(gravity) * 0.9800000190734863(Movement multiplier) = -0.0784000015258789, which is the downwards motion you get when you are on the ground and takes damage.

      Edit: Found a pitfall when attempting to patch it myself, in the Entity class, player's "onGround" status is controlled by the player being falling in the server's perspective, which would cause the player to not be on ground for a majority of the time, to replicate the exact effect of what happens before the patch, the original check of movement.y < 0 should be changed to `movement.y < 0 || this instanceof ServerPlayer && movement.y - (((ServerPlayer) this).hasEffect(MobEffects.SLOW_FALLING)? 0.01D : 0.8D) * 0.9800000190734863D < 0.0D`.

            Unassigned Unassigned
            shuaiouke shuaiouke
            Votes:
            5 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              CHK: