[TUTORIAL] How to make entity attack everything except its own kind.

Started by BryAstro on

Topic category: Help with Minecraft modding (Java Edition)

Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[TUTORIAL] How to make entity attack everything except its own kind.
Fri, 04/17/2026 - 05:19 (edited)

First, make sure you put a "Do attack" block a "Fight attacker mobs back" block so your desired mob can attack and fight back.

Next, make sure you have this as your entity tick update procedure:

The code.

Alternatively, you could replace the entity tags block with the (sub)type block if you only want the entity to spare its own kind exclusively.

Credits to https://www.youtube.com/@gibbhartin643 for giving me the framework (Gibb didn't make a video tutorial but since Gibb told me the procedure I thought it would be nice to give some credit), I've only made a few modifications to the framework to fix any issues that were present.

Edited by BryAstro on Fri, 04/17/2026 - 05:19