How to make infected mob target all non-infected mobs?

Started by Draconic Mouse on

Topic category: Help with MCreator software

Joined Mar 2026
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make infected mob target all non-infected mobs?

I'm working on a infection mod, and want my infected mobs to target all living entities except for creepers and other infected mobs. I've created an AI task to target all living entities, and created a start condition: 

Return logic: (NOT is event/target entity (sub)type of creeper) AND (NOT is event/target entity tagged in entity tags as rotten_world:rotted)

The rotted tag is set up properly. I think event/target entity is referring to the entity that's trying to attack, not the entity that's going to be attacked. How can I check whether the entity that's GOING TO BE ATTACKED is tagged as rotted or not?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well it should be that the…
Tue, 03/31/2026 - 13:40

Well it should be that the source entity is your entity and the event/target entity is the targeted one. Just try that, if that doesn't work you can also try immediate source entity. If neither works you can try using an entity iterator.

Joined Mar 2026
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If I use source entity or…
Tue, 03/31/2026 - 14:26

If I use source entity or immediate source entity, the procedure says, "Missing dependencies" when I try to attach it to the AI task. Event/target entity is my entity, I've already said that, and debug is always saying the entity is infected, which is WHY I think that. 

What do you mean by saying "use an entity iterator" in this context? I know what they are, but since this is a condition for a procedure on whether a mob targets ONE specific other mob, how would that work?

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
That's actually long winded…
Wed, 04/01/2026 - 12:48

That's actually long winded. Have you used the [get entity event/target entity is targeting for attack] procedure block. You can use that to find the targeted entity without the dependency.

Joined Mar 2026
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, but the attack target…
Thu, 04/02/2026 - 05:04

Yes, but the attack target isn't actually set yet, as the procedure runs when the mob is figuring out whether to set the attack target to the nearby mob or not.

Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The condition procedure you…
Thu, 04/02/2026 - 08:26

The condition procedure you are running is whether to allow the infected entity is allowed to run the ai task target all living entities. As you said it hasn't set the attack target because it hasn't even been allowed to run the task yet. 

After thinking and looking some more it doesn't really seem easy/possible to do what you want. One idea would be to run a procedure off global trigger entity sets target and then set its target to an entity iterator of tag:non_infected that you can make and add all entities but your infected. Or make an infected tag and set its target to entity iterator if entity iterator is not tag:infected. Might not work very well though. Could also make a fallback to set target to null entity but could also come with problems.

Otherwise you can potentially make either tag all the same. Then lock the entity and go into the code and switch the all living entities for your tag. Maybe switch all living entities to a vanilla entity tag as it should be easier to switch in your own tag. No idea if this is possible but worth looking into if the thing above is janky.