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

Started by Greenhead on Sat, 10/03/2020 - 15:11

Topic category: Help with modding (Java Edition)

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How do i make a mob atttack everyone but the player?
Sat, 10/03/2020 - 15:11

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 19:45, 23. Nov 2020
Joined Nov 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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
User points:

User statistics:

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

Thank you!

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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