How do I add or modify AI features to existing mobs?

Started by ruoshili on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I add or modify AI features to existing mobs?

I recently encountered a few roadbocks to a mod I'm currently making, and I wasn't able to find any tutorials that suit my case, so hopefully some of you nice people can help me with what I'm trying to code:

  1. A "flag-bearer" enemy which makes other hostile mobs follow it, and aggro onto any entity it gets hit by.
  2. An "observer" zombie that seeks the highest point (on th y axis) then uses its spyglass (I already made the animation). It then make all undead enemies around it aggro onto the nearest player in the world.
  3. A zombie that, when killed, spawns a layer of flesh on the ground that, if not mined fast enough, spawns another enemy.

Hopefully some of you will know how to implement this!

Thanks in advance!