Topic category: Help with Minecraft modding (Java Edition)
Hi Guys So Im Trying To Make An Infection Like Mod, So A Mob Will Attack Every Living Entity Except Entities From The Selected Tag Here's How I Made This(Every Time The Mob Tries To Target Something It Will Crash The Game And When I Change To Any Other Procedure It Just Doesn't Work, And Also The Sub Types Don't Work To) Sorry I Don't Have Images And I Don't Know How To Upload Via URLS:
Entity AI And Goals:
-Attack Enities Of Type Living Entity. Conditions:
-AttackNonEyeCreatures Condition - Additional Starting Condition And Additional Continuing Condition
-AttackNonEyeCreatures Procedure:
-Return Not Is Get Entity Event/Target Entity Is Targeting for attack tagged as "eye_attack:eye_army"(the mod name is eye_attack and the tag id is eye_army)
For a behavior like this, you probably don't want to do this using AI, you want to make a custom procedure that runs on entity update tick.
In the procedure, use an 'entity iterator' bracket to get all the entities in a desired radius. (Anything inside the bracket that refers to 'entity iterator' instead of 'event/target entity' will target each individual entity in the radius, instead of the entity calling the procedure.)
Inside the entity iterator bracket, first check if the entity iterator is not tagged in your custom tag. If it is not, use the 'set attack target' function to set the attack target of the event/target entity, (NOT the entity iterator), to the entity iterator.
You might need to add some additional variables and math to specifically target the nearest entity, but this should be enough for most purposes.
hey! i'm pretty new to mcreator and i'm stuck with the same issue, can you send a picture of the procedure?
The method suggested by Mindthemoods isn't working anymore. The entity iterator condition just ignores all entity tags (which seems to be broken for the latest Mcreator version available)
https://ibb.co/RCjsRRG Here have a way you could do this