Mobs with no Attack Goal cannot use `custom_hostile.json`
mxnmnm opened this issue ยท 3 comments
Describe the bug
The Fight back chance under the animals configs ends up conflicting with custom ai's setup in the custom_flee.json and custom_hostile.json. The values chosen in the config will end up overwriting anything you did assuming you pick the mobs that are impacted by this config.
Versions where you encountered the problem (Use the exact version numbers, not 'latest' or similar):
- Minecraft: 1.20.1
- Neoforge: 47.1.103
- Enhanced AI: 2.4.2
- InsaneLib: 1.13.2
Steps to reproduce
- Set the Fight back chance to 0 in the config
- Make pigs attack chickens using the custom_hostile.json
- Make chickens run away from pigs using the custom_flee.json
- Watch as pigs don't attack the chickens (they still run away at this point)
- Set Fight back chance to 1 in the config
- Watch as chickens run away from the pigs until one of them gets hit, where they then ignore the custom_flee.json and just attack the pigs
Logs
https://gist.github.com/mxnmnm/6d2d9f68547fd8c3966256bf7cdcaccd
Can the issue be reproduced with EnhancedAI only (or with a minimal set of mods)?
Yes
The problem is that pigs (or most animals) don't have the MeleeAttackGoal
, so they set the Chicken as a target but have no attack goal to attack them. Setting fighting back will make pigs attack chickens as they have the attack goal.
where they then ignore the custom_flee.json and just attack the pigs
As for this, as soon as the flee goal doesn't find a pig to flee from or a path, the goal fails and the attack back starts.
I will think about adding a custom_attack.json to add the attack goal to entities in the future