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
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.
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}]}
Still affects the newest snapshot 20w18a.