How do i make a mob atttack everyone but the player?

Started by Greenhead on

Topic category: Help with modding (Java Edition)

Last seen on 09:08, 21. Nov 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do i make a mob atttack everyone but the player?

Hi, im making a mod that adds terraria-like summons. How do i make so it follows the player and attacks other mobs?

Last seen on 14:43, 2. Aug 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Use the look at nearest …
Sat, 10/03/2020 - 19:16

Use the look at nearest (Player) task.

Add attack entity task.

 

Lock the code and replace

this.targetSelector.addGoal(5, new NearestAttackableTargetGoal(this, ZombieEntity.class, true, false));

With:

this.targetSelector.addGoal(5, new NearestAttackableTargetGoal(this, MonsterEntity.class, true, false));

 

This will make the mob attack monster entities.

Note the '5' is the tasks order so whatever number was there when you edited the code you should replace the 5 with.

I noticed that EntityMonster was in the procedure menu but not the AI task menu.

Last seen on 09:08, 21. Nov 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you!
Sun, 10/04/2020 - 09:11

Thank you!

Last seen on 09:08, 21. Nov 2020
Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It doesent attack mods or i…
Tue, 10/06/2020 - 13:00

It doesent attack mods or i think it didnt save the code? How to fix this