Mojira Archive
MC-167008

Slow Falling doesn't affect squids or glow squids

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 [Mod] Anthony Cicinelli
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;
      }

Unresolved

Bluebird

Daniel K.

2019-12-03, 01:41 AM

2024-12-07, 08:30 AM

11

4

Confirmed

Mob behaviour

1.14.4 - 1.21.41.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

-