Started by
carnivowrist
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make a procedure in which each tick (or every X ticks) it will set the attack target of an entity to the nearest entity to it, but if i use "get nearest entity" it will select itself, and so if i make it the attack target, the entity attacks itself as it considers itself the nearest. I tried other things like "for each entity as 'entity iterator' at X Y Z" --> set the attack target to entity iterator, which works well but this sets the attack target of the entity to the furthest entity to it.. i have no solutions
try this, I haven't tested it,
hello i tested but it didn't work, it still gets the furthest entity. I don't know if it's because of different Mcreator version as yours looks slightly different (i have 2023.4)
what does yours look like? can you send a screenshot
this what it looks like https://ibb.co/6JLnYL5j
first it checks if cooldown is over, then it checks if the entity is the right one (if i remove my stuff it still doesn't work)
hm, this worked,
with this you can make a tag for the ones to skip,
replace
"minecraft:skeletons"
with your tagoh yeah and the
5, 5, 5
in the first line is the size it should look inoh you can't add players to entity tags?
what entities do you need to not be affected?
it's okay if i can't exclude the player like in the screenshot but sometimes it will be 5 to 20 type of entities
oh then you should probably use the tag method,
thank you! if you're good with custom code do you by chance know how to disable entity invulnerability for some cases? I have an entity with fast attacks or a weapon that shoots fast and the invulnerability ruins it, i heard it can be done with custom code but i couldn't get it right
try this,
i think i don't have this block in my version.. atleast i can't find it i got 2023.4 and i can't change it