#Can an entity be prevented from attacking us when wearing a piece of armor?

1 messages · Page 1 of 1 (latest)

lime yarrow
#

I don't know if it's possible, but how do I make a piece of custom armor so that when we use it, these entities don't attack us when we use it? (Like the behavior of piglins)

static pond
lime yarrow
static pond
#

There should be a has_equipment filter

lime yarrow
#

I also thought that by adding the line of code where a piglin does not attack the player when we use a piece of armor an entity would have that behavior

#

The problem is that I want it to do that function on hostile entities except bosses.

static pond
lime yarrow
# static pond

The problem is that I have to place that behavior in all the behavior files of the entities that I want to be affected by it.

#

And I already did that but it didn't work for me, I don't know if it is necessary for its behaviors to be from the new versions

static pond
#

?? Do you have many entities that you want to have the same behavior?

lime yarrow
#

Except for the bosses

lime yarrow
static pond
#

You say this doesn't work???

lime yarrow
static pond
#

It's not possible, show me how you did it

lime yarrow
# static pond It's not possible, show me how you did it

Well I used the hostile entity behavior files from the official resource pack, and along with the piglin behavior in that part of the code I decided to copy and paste that line into the other entities, (right where it says which entity they should attack along with their conditions) but when I wanted to try it didn't work and that's even though I put the name of the attachable that I want

#

After that I gave up because I tried that 20 times

#

So I deleted those entity behavior files

static pond
lime yarrow
#

What I changed is the name of the attachable

static pond
lime yarrow
#

I will try to change it

static pond
lime yarrow
#

That is, smaller numbers

#

The lower the number, the higher the priority?

static pond
#

But you also have to be careful, so that other components do not alter the attack priority.

#

yes

static pond
lime yarrow
#

So I have to set a higher priority so that the other behaviors that have priorities are lower than the highest one.

#

Just like the attachable

lime yarrow
static pond
#

{
"filters": {
"any_of": [
{ "test": "is_family", "subject": "other", "value": "player" },
{ "test": "is_family", "subject": "other", "value": "snowgolem" },
{ "test": "is_family", "subject": "other", "value": "irongolem" }
]
},

          "max_dist": 35
        },

remove the first filter

#

,,mmmm no wait

#

I think it's better

#

Yes, delete it

#

@lime yarrow

lime yarrow
static pond
#

no

lime yarrow
static pond
#

delete that filter

lime yarrow
#

Ok, I'll see.

static pond
#

It is the first

lime yarrow
#

It works the same as piglins

#

But if I removed the part about attacking iron golems, snow golems, etc., wouldn't that affect its behavior?

#

Maybe it will work if I put the line I deleted at the end.

static pond
lime yarrow
static pond
#

Ok, deleting all that filter was too much, it's fixed here

lime yarrow
static pond
lime yarrow
#

Yey, yes it works :3

#

If you attack what you should attack

#

Now to place this function on the entities that I want to have it 🙂

lime yarrow
static pond