Topic category: Help with Minecraft modding (Java Edition)
How to make a mob attack ALL entities with a certain name or item in their hands?
No, I know how to do it, just read it, please. I made a variable, connected everything I needed, and when I put the mob one on one with another, it did not start hitting the enemy. Yes, that's right, that's how it should be. When I gave the enemy an item, my mob started hitting the enemy - do you think what's the problem? If I put one enemy with an item and summon a lot of my mobs, then none of them will beat the enemy, THEY DON'T UNDERSTAND.
My mod is about the war between blue and red men. There are already 50 mobs in my mod, and every time I add new ones, I have to change the AI of ALL MOBS and add only 1 block to their AI - it attacks this new mob. My mod is planned to have about 100+ men, but the fact is THAT THEY are DIVIDED into blue and red, that is, two separate mobs. And, as I said, I have to suffer. Therefore, I decided to bypass these torments, but without success.. What's the matter? Is this a bug in mcreator? How to fix it? Sorry, I'm tired. I want to keep making my mod, because I like it, but when adding a new mob I have to make 1000 clicks
I solved this problem a long time ago, but I forgot to close the forum.
I used the procedure when updating the tick:
if this entity is an [entity] and the entity targeting for attack is not a living entity, then if there are [entity iterator] entities with a tag in the radius of the square cube, then set the attack target of event/target to entity iterator