Make mobs ONLY attack adult mobs

Started by ItzBlueJacob on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Make mobs ONLY attack adult mobs

Hello! I'd like to know is it even possible for mobs to not attack baby mobs? I'm working on a mod that adds illagers and since in 1.18+ the vanilla ones do not attack baby villagers

And I plan to make my illagers do the same, is it possible for me to make a procedure/trigger to prevent them from attacking baby villagers?

Joined Sep 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you can use the metadata…
Thu, 05/09/2024 - 04:51

you can use the metadata plugin to check the villager's Age tag. if the age is less than zero, it is a baby.

an important note: if you ever want to carry this over to mobs that don't grow up if they are babies (zombies, drowned, etc): they have a separate IsBaby tag that controls if they're a baby or not