Improved Mobs (Forge)

Improved Mobs (Forge)

15M Downloads

Neutral mobs always attack villagers if NEUTRALAGGRO is disabled

Alainx277 opened this issue ยท 5 comments

commented

Modloader

Forge

Minecraft version

1.20.1

Modloader version

47.3.0

Mod version

1.20.1-1.13.2

TenshiLib version

1.20.1-1.7.6

Description

Because of a logic mistake neutral mobs will always aggro on villagers if NEUTRALAGGRO is disabled (globally or for that entity).

The incorrect check assumes that mobs are aggressive if that feature is disabled. It should instead only do this if it is a hostile mob.

if ((mob instanceof NeutralMob) && !Config.CommonConfig.entityBlacklist.hasFlag(mob, EntityModifyFlagConfig.Flags.NEUTRALAGGRO, Config.CommonConfig.neutralAggroWhitelist)) {
aggressive = Config.CommonConfig.neutralAggressiv != 0 && mob.getRandom().nextFloat() < Config.CommonConfig.neutralAggressiv;
if (aggressive)
mob.targetSelector.addGoal(1, setNoLoS(mob, Player.class, ignoreSight, null));
} else
aggressive = true;

Bug was introduced by efc1825

Steps to reproduce

  1. Spawn a villager
  2. Spawn a bee
  3. The bee will aggro on the villager

Mods that might affect the issue

No response

Logs

commented

yes that is intended. if you want to disable villager targeting for a mob there is a villager target flag.
the special case with neutral mobs is that neutral mobs should only attack something if they are angered. otherwise the assumption is that the mob is always angered

the config by default only includes hostile mobs to be modified anyway so my guess it you changed the config.

commented

So it is intended that neutral mobs (such as bees) ALWAYS attack villagers even though I disabled the entire neutral aggro feature? If the feature is enabled but the probability is set to 0.0 they are not aggressive, so I don't see why disabling the feature should make them always aggressive.

Also did you check the code I referenced & the commit that changed the behaviour?

commented

yes. rather setting the prob to 0 and it NOT doing anything would be the unintended behaviour.

for simplicity lets just remove the whole neutral thing:
the villager flag would then decide solely if a mob goes after villagers (thus assumption would be aggressive = true always)

commented

closing this since this seems now be resolved

commented

yes. rather setting the prob to 0 and it NOT doing anything would be the unintended behaviour.

Okay but that's how it currently works (and how I "fixed" it on my end). Setting it to probablity 0 makes it not do anything (which makes sense to me).

I still don't understand why NEUTRAL_AGGRO = false == all peaceful mobs attack all villagers.