Search for nearest entity other than current player

Started by progamezia on

Topic category: Help with Minecraft modding (Java Edition)

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!

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!

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!

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?

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"

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>>.