You can use the minecraft:generic.attack_knockback attribute to change the attack knockback of a mob. But if you try to do this with players it does not work. It says entity name has no Attribute Attack Knockback. For mobs it works fine.
How to reproduce:
Run this command: /attribute @s minecraft:generic.attack_knockback base set 0
It fails.
minecraft:generic.flying_speed has the same issue.
It seems like minecraft:generic.flying_speed also does not work on mobs.
This also doesn’t work if you have the attribute on an item. You can for example use this command:/give @p minecraft:stick{AttributeModifiers:[{AttributeName:"generic.attack_knockback",Name:"generic.attack_knockback",Amount:10,Operation:0,UUID:[I;5,5,5,5],Slot:"mainhand"}]} 1 and the attribute of the item will only work on mobs.
Related issues
is duplicated by
relates to
Attachments
Comments


Also relates to MC-138868.

Not all entities have the same attributes.
Adding an attack knockback attribute for players is a feature request.

But why don’t have players an attack knockback attribute? I don’t see any reason for them to not have this attribute.

Wait, players are not intended to have this basic attribute?