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

Slow Falling doesn't affect squids or glow squids

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.14.4, 20w18a, 1.16.1, 20w27a, 20w28a, 20w29a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4 Release Candidate 1, 1.16.4, 20w45a, 20w46a, 20w48a, 20w49a, 20w51a, 1.16.5, 21w10a, 21w11a, 21w13a, 21w14a, 21w15a, 21w17a, 1.17.1, 1.18.2, 1.19, 1.19.2, 23w13a, 1.20.4, 1.21.3, 24w45a, 1.21.4
    • None
    • Confirmed
    • Mob behaviour

      The slow falling effect does not slow down the movement of squids or glow squids while mid air.

      Command to Reproduce

      (squid)

      /summon minecraft:squid ~ ~30 ~ {active_effects:[{duration:-1,amplifier:0b,id:"minecraft:slow_falling"}]}

      (glow squid)

      /summon minecraft:glow_squid ~ ~30 ~ {active_effects:[{duration:-1,amplifier:0b,id:"minecraft:slow_falling"}]}

      Code Analysis

      Code Analysis done by Thumpbacker
      The issue here is that there is no check for the effect causing vertical movement to stay the same in the aiStep method

      Current Code

      net/minecraft/world/entity/animal/Squid.java
      ...
      else {
               this.tentacleAngle = Mth.abs(Mth.sin(this.tentacleMovement)) * (float)Math.PI * 0.25F;
               if (!this.level.isClientSide) {
                  double d1 = this.getDeltaMovement().y;
                  if (this.hasEffect(MobEffects.LEVITATION)) {
                     d1 = 0.05D * (double)(this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1);
                  }
                  else if (!this.isNoGravity()) {
                     d1 -= 0.08D;
                  }
      
                  this.setDeltaMovement(0.0D, d1 * (double)0.98F, 0.0D);
               }
      
               this.xBodyRot += (-90.0F - this.xBodyRot) * 0.02F;
            }
      

      Fixed Code

      net/minecraft/world/entity/animal/Squid.java
      else {
               this.tentacleAngle = Mth.abs(Mth.sin(this.tentacleMovement)) * (float)Math.PI * 0.25F;
               if (!this.level.isClientSide) {
                  double d1 = this.getDeltaMovement().y;
                  if (this.hasEffect(MobEffects.LEVITATION)) {
                     d1 = 0.05D * (double)(this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1);
                  }
                  else if(this.hasEffect(MobEffects.SLOW_FALLING))
                  {
                     //Adding a check for slow falling and changing the speed fixes MC-167008
                     d1 = -0.05D * (double) (this.getEffect(MobEffects.SLOW_FALLING).getAmplifier() + 1);
                  }
                  else if (!this.isNoGravity()) {
                     d1 -= 0.08D;
                  }
      
                  this.setDeltaMovement(0.0D, d1 * (double)0.98F, 0.0D);
               }
      
               this.xBodyRot += (-90.0F - this.xBodyRot) * 0.02F;
            }
      

        1. MC-167008.png
          MC-167008.png
          2.83 MB
        2. MC-167008.mp4
          3.74 MB

            Unassigned Unassigned
            BluebirdMC Bluebird
            Votes:
            11 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: