how to make an aggressive mob passive under certain conditions

Started by lol_fantom_lol on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to make an aggressive mob passive under certain conditions

How do I make an aggressive mob, say a zombie, become player neutral when, say, some global variable is true for the player?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm not entirely sure if…
Fri, 10/21/2022 - 12:44

I'm not entirely sure if this is possible- at the very least, not without custom code. Mob aggression is pretty hard coded into different mobs. If you wanted to brute force it, I guess you could add a custom version of the desired mobs that looks and behaves similarly but doesn't attack the player, and then have a procedure that replaces the hostile versions with the passive version when the player is near, using the correct location and rotation to make it (more or less) seamless. This method wouldn't play nice with resource packs though- or other mobs involving said mob.

...If it's specifically in reference to a piece of armor, I know there's a simple way you can use it to de-aggro piglins. But since that's already coded into the game, I don't know if you could do the same for another mob, like Zombies.