Search for nearest entity other than current player

Started by progamezia on

Topic category: Help with modding (Java Edition)

Last seen on 08:13, 19. May 2023
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Search for nearest entity other than current player

Hello!I am trying to give the entity nearest to the player some effects when an item is used.All the other things are working except that the negative effects are being given to the player who used the item because its the nearest entity.Is there any way to check for nearest entity other than the current player.I would like this to work with other nearby players and not just mobs,so any help would be appreciated!

Thank you!

Last seen on 23:28, 12. May 2024
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You would have to use the…
Fri, 03/04/2022 - 18:14

You would have to use the entity iterator block, if you do want to heres a procedure i made: https://imgur.com/a/UE0LqOe

Last seen on 23:28, 12. May 2024
Joined Aug 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Actually i made a different…
Fri, 03/04/2022 - 18:17

Actually i made a different one but this one might not work idk tho i didnt test it: https://imgur.com/a/8SoLbhI

Last seen on 08:13, 19. May 2023
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
alright,i will try them and…
Tue, 03/08/2022 - 07:17

alright,i will try them and inform you if they work.

Thank you!

Last seen on 08:13, 19. May 2023
Joined Jan 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The entity iterator one…
Tue, 03/08/2022 - 07:51

The entity iterator one works perfectly and just like i wanted it to,thank you so much!

Last seen on 12:36, 28. Jun 2023
Joined Dec 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm having a similar problem…
Mon, 06/12/2023 - 02:00

I'm having a similar problem but I want to target the single nearest entity instead of all nearby entities. The solutions Chasebear777 gave don't work for me since the first one targets all nearby entities and the 2nd just simply doesn't work.

Is there a way to do the same thing but with only a single target?

Last seen on 08:39, 19. Nov 2023
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
SuperUltraNinja do "and: not…
Wed, 07/19/2023 - 14:19

SuperUltraNinja do "and: not: nearest entity = event/target entity"

Last seen on 13:24, 27. Jan 2024
Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think there might be a…
Wed, 07/19/2023 - 15:32

I think there might be a problem if the nearest entity isn't a player because you don't check whether the nearest entity's a player. I think it would work with <is entity subtype of <entitytype>>.