Pigs despawn on attack - Can't find attribute minecraft:generic.attack_damage
Summary
I configured the following pig to attack players using MythincMobs 5.0.4.
Wildschwein:
Type: PIG
Display: '&8Wildschwein'
Health: 25
Damage: 8
AIGoalSelectors:
- 0 clear
- 1 meleeattack
- 2 randomstroll
AITargetSelectors:
- 0 clear
- 1 players
Options:
Angry: true
PreventOtherDrops: true
PreventItemPickup: true
PreventRenaming: true
Interactable: false
KnockbackResistance: 0.5
When the pig is about to attack a player, the pig despawns and the following error occours in the console log:
[11:47:09] [Server thread/ERROR]: Entity threw exception at world:508.8488889113545,52.0,-2767.1202016608704
java.lang.IllegalArgumentException: Can't find attribute minecraft:generic.attack_damage
at net.minecraft.world.entity.ai.attributes.AttributeSupplier.getAttributeInstance(AttributeSupplier.java:22) ~[?:?]
at net.minecraft.world.entity.ai.attributes.AttributeSupplier.getValue(AttributeSupplier.java:28) ~[?:?]
at net.minecraft.world.entity.ai.attributes.AttributeMap.getValue(AttributeMap.java:65) ~[?:?]
at net.minecraft.world.entity.LivingEntity.getAttributeValue(LivingEntity.java:2410) ~[?:?]
at net.minecraft.world.entity.Mob.doHurtTarget(Mob.java:1533) ~[?:?]
at net.minecraft.world.entity.ai.goal.MeleeAttackGoal.checkAndPerformAttack(MeleeAttackGoal.java:142) ~[?:?]
at net.minecraft.world.entity.ai.goal.MeleeAttackGoal.tick(MeleeAttackGoal.java:134) ~[?:?]
...
Am I missing something or is this a bug?
I already tried to add the option AttackSpeed
, but this doesn't fix the issue.
Steps to reproduce
Create a config file for the given mob, spawn it and let it attack a player.
Current behavior
The pig despawns.
Intended correct behavior
The pig should not despawn and deal damage to the player.
Debug log snippet
Proposed fixes
I googled a bit and found out that the attibute attack_damage of entities is not writeable by default, but this can be changed (and I think this is already done). But maybe the error occours because the pig is an passive mob which maybe doesn't have the attack_damage attribute by default?