How to make entity not attack a player with specific item in hand?

Started by The Very Expir… on

Topic category: Help with modding (Java Edition)

Last seen on 22:49, 13. Jul 2024
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make entity not attack a player with specific item in hand?

I tried to do something like the opposite of this, but it didn't seem to work: https://mcreator.net/forum/80483/tutorial-mobs-only-attack-player-if-wearing-or-holding-hand-particular-item?page=0

I'm trying to make a ranged item which summons a custom entity once the projectile lands, and that entity should attack everything except for the player who shot the projectile. When the projectile lands, the entity just stands there and walks around like a regular animal.

Any help is appreciated :)

Last seen on 17:16, 25. Apr 2024
Joined Mar 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you can do a condition…
Mon, 03/11/2024 - 17:43

you can do a condition procedure for the block that makes the mob attack you in "tasks and ai" it would be something like this:

"if" "not" "item on hand of-" "get nearest entity... - ...player" = " (your item) " then

return

if you dont understand, do a reply and i will send a picture of the procedure