Mob that doesnt attack mobs of the same type

Started by Chiwi on Sat, 05/02/2020 - 13:20

Topic category: Help with modding (Java Edition)

Last seen on 21:45, 1. Jan 2021
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Mob that doesnt attack mobs of the same type
Sat, 05/02/2020 - 13:20

Is it possible that mobs that makes ranged attacks dont attack other mobs like them. I mean, when they are shooting, if accidentally hit other mob of the same type, they start to shoot each other. I tried a lot of different combinations but i dont get it 

Last seen on 20:51, 4. Aug 2021
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You could possibly make the…
Sun, 05/03/2020 - 16:01

You could possibly make the mob immune to ranged attacks, but this would also prevent he player from using ranged weapons on the mob.

Otherwise;

I do not believe there is a way to do this without using the built in code editor, and if it comes down to writing AI task codes, I would get lost.

Last seen on 19:18, 4. Aug 2021
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I was looking for this post…
Thu, 05/07/2020 - 20:50

I was looking for this post for hours because I saw it and found the answer.

 

if (source.getImmediateSource() instanceof this.getType())
				return false;

//paste this in : public boolean attackEntityFrom(DamageSource source, float amount) {