mojira.dev
MC-260090

Sniffers ignore the "minecraft:generic.movement_speed" attribute

The Bug:

Sniffers ignore the "minecraft:generic.movement_speed" attribute.

Steps to Reproduce:

  1. Summon a sniffer with its "minecraft:generic.movement_speed" attribute set to a value of "0" by using the command provided below.

    /summon minecraft:sniffer ~ ~ ~ {Attributes:[{Base:0.0d,Name:"generic.movement_speed"}]}
  2. Wait for the sniffer to begin wandering around.

  3. Take note as to whether or not sniffers ignore the "minecraft:generic.movement_speed" attribute.

Observed Behavior:

Sniffers ignore the "minecraft:generic.movement_speed" attribute.

Expected Behavior:

Sniffers would not ignore the "minecraft:generic.movement_speed" attribute.

Code Analysis:

Code analysis by @unknown can be found in this comment.

Comments 1

Code analysis: in Sniffer#tick, the first line overwrites the movement speed attribute every tick.

getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(isInWater() ? 0.2 : 0.1);

Use the below commands to verify that the movement speed attribute is overwritten after modifying (movement speed should be 0.42, but is 0.1 or 0.2).

/data modify entity @e[type=minecraft:sniffer,limit=1,sort=nearest] Attributes[0].Base set value 0.42
/data set entity @e[type=minecraft:sniffer,limit=1,sort=nearest] Attributes[0].Base

Avoma

v-hjonson+bugs

Confirmed

Expansion B

Low

Commands, Mob behaviour

sniffer

23w07a, 1.19.4 Pre-release 1, 1.19.4 Pre-release 2, 1.19.4, 23w12a

23w13a

Retrieved