mojira.dev
MC-124709

When drinking a potion, Witches' movement speed modifier is -0.25 instead of -100%

When drinking a potion, witches are given an attribute modifier that affects generic.movementSpeed with a value of -0.25 and an Operation of 0. As Witches' default value for generic.movementSpeed is 0.25, this effectively sets their generic.movementSpeed to 0. However, if a Witch is summoned with a custom generic.movementSpeed value over 0.25, it will be able to move while drinking a potion. If the custom value is under 0.25, then the witch will be able to move whilst under a slowness effect with amplifier 7 or greater, as 7 gives -105% movement speed. At negative movement speeds, that will become a positive movement speed.

The fix for these strange cases is to just make the attribute modifier for drinking potions be -1 with Operation 2, as this will set the witch's generic.movementSpeed attribute to 0, even if it has drunk a speed potion.

Steps To Reproduce: (from @unknown)

  1. Run the command

    /summon witch ~ ~ ~ {Attributes:[{Name:"generic.movement_speed",Base: 1.0d}]}
  2. Shoot the witch with a Flame bow.

  3. Observe how the witch still moves while drinking a Fire Resistance potion.

Attachments

Comments 5

Is this an issue on 1.12.2?

Is this still an issue in Minecraft version 1.13.2?

Why are you asking me? Why are you making me go check something that takes all of 2 seconds instead of doing it yourself while you're already here? Why are you sidelining this issue until I eventually find time to check my email?

 

YES, it is still an issue in 1.13.2. This is the kind of bug that requires a very intentional fix anyways, so I would be very surprised if it was accidentally fixed without being marked as fixed in a snapshot/pre-release.

Can confirm in 1.17.1. To reproduce:
1. Run the command

/summon witch ~ ~ ~ {Attributes:[{Name:"generic.movement_speed",Base: 1.0d}]}

2. Shoot the witch with a Flame bow.

3. ❌ Observe how the witch still moves while drinking a Fire Resistance potion.

I can confirm this behavior in 1.18.1.

Here's a code analysis of this issue. The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.

Code Analysis:

net.minecraft.world.entity.monster.Witch.java

public class Witch extends Raider implements RangedAttackMob {
   ...
   private static final AttributeModifier SPEED_MODIFIER_DRINKING = new AttributeModifier(SPEED_MODIFIER_DRINKING_UUID, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION);
   ...

If we look at the above class, we can see that when witches drink potions, their movement speed modifier is -0.25D.

Avantir_Yihn

(Unassigned)

Confirmed

Mob behaviour

Minecraft 18w05a, Minecraft 1.13.2, 1.15.2, 1.17.1, 1.18.1, 1.21, 1.21.7

Retrieved