Started by
a23709g3
on
Topic category: Help with Minecraft modding (Java Edition)
living entity attack condition doesnt work for me
i used all methods to make it, didnt worked in any.
Topic category: Help with Minecraft modding (Java Edition)
living entity attack condition doesnt work for me
i used all methods to make it, didnt worked in any.
Could you be a little more specific about what isn't working? What methods have you tried, and what happened?
i wanted to make entity dont attack me if i wear specific armor.
i used all methods that i know in procedure to make it but none of them worked
The problem you're likely having is that there isn't a built-in method to disable attack targets. You should be able to easily set the attack target of an entity to something else, but actually deaggravating it is more difficult.
One workaround you could try is creating an invisible, immovable, unkillable entity with extremely high health. In your armors update tick, have it run an entity iterator in a large radius, targeting entities of the type you want to deaggravate. For each entity in the iterator, check if its attack target equals the event/target entity, (the player), and, if it does, spawn the invisible entity.
In the invisible entity's update tick, have it check for a nearby entity of the correct type, and, if it finds one, set that entity's attack target to itself. Then, despawn the invisible entity. This will effectively reset an entity's attack target, and as long as you use an entity iterator, it will do this for all of that entity type in a radius. It's not an ideal solution, but I've been able to get it working in the past.