mojira.dev
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"}]}
/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"}]}
/summon minecraft:glow_squid ~ ~30 ~ {active_effects:[{duration:-1,amplifier:0b,id:"minecraft:slow_falling"}]}

Code Analysis

Code Analysis done by @unknown
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;
      }
...
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;
      }
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;
      }

Attachments

Comments 14

Still affects the newest snapshot 20w18a.

Affects 1.16 pre-release 3

Confirmed for 1.16-rc1

Can confirm in 21w06a I would like to request ownership, the original reporter hasn’t been active since February 2020 (exactly one year today), I will keep it updated.

Confirmed for 21w10a. This also affects the glow squid.

4 more comments

Confirmed for 21w17a.

Can confirm in 1.17.1.

Can confirm in 1.19. You can execute either of the following commands in order to easily reproduce this issue.

/summon minecraft:squid ~ ~30 ~ {ActiveEffects:[{Id:28b,Amplifier:1b,Duration:10000}]}
/summon minecraft:squid ~ ~30 ~ {ActiveEffects:[{Id:28b,Amplifier:1b,Duration:10000}]}
/summon minecraft:glow_squid ~ ~30 ~ {ActiveEffects:[{Id:28b,Amplifier:1b,Duration:10000}]}
/summon minecraft:glow_squid ~ ~30 ~ {ActiveEffects:[{Id:28b,Amplifier:1b,Duration:10000}]}

Can confirm in 1.19.2.

Can confirm in 1.21.3 & 24w44a however the squids no longer take fall damage with the effect, unlike in the previously attached video.
I would also like to request ownership as the original reporter hasn't been active in a while.

Daniel K.

Bluebird

(Unassigned)

Confirmed

Mob behaviour

1.14.4, 20w18a, 1.16.1, 20w27a, 20w28a, ..., 1.20.4, 1.21.3, 24w45a, 1.21.4, 1.21.6

Retrieved