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!

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Behavior like this will…
Fri, 02/14/2025 - 03:27

Behavior like this will require you to set the entity to have no ai in the entities ai editor, then you have to create your own state machine and ai handling using the entitys triggers and variables. Use the 'attempt to amke entity find path' block to guide around your entities then use other blocks and animation triggers to manage their various abilities.

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I recently encountered a few…
Tue, 02/18/2025 - 21:22

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!

uhhh... what a tedious task. you'd have to use procedures

 

Joined Jan 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Behavior like this will…
Wed, 02/19/2025 - 17:16

Behavior like this will require you to set the entity to have no ai in the entities ai editor, then you have to create your own state machine and ai handling using the entitys triggers and variables. Use the 'attempt to amke entity find path' block to guide around your entities then use other blocks and animation triggers to manage their various abilities.

Thanks, but, how do I apply the reworked AI to pre-existing mobs, like zombies and creepers?