Sign in
Skip to main content

Discuss Minecraft's scripting and modding capabilities, including APIs, tools, customization, automation, and creator workflows. Share ideas and feedback on how players and creators can extend and customize Minecraft.

50

@n Selector for nearest entity

9 Comments

Post a new comment:

Please sign in to leave a comment.

Sorted by oldest
  • 2
    Registered User commented
    Comment actions Permalink

    So it's a shorter way of saying:
    @e[sort=nearest]
    Well, why not? Maybe there's some reason behind not implementing it, but it's a cool idea.

  • 0
    Registered User commented
    Comment actions Permalink

    Es mucho más cool

  • 0
    Registered User commented
    Comment actions Permalink

    Use variable c and it equal to one this should target the nearest entity. Example kill @e[c=1] this will kill nearest entity.

  • 2
    Registered User commented
    Comment actions Permalink

    this would work kind of like using @e[sort=nearest,limit=1] but excluding the entity executing the command, which I think is a brilliant idea. Because that would make it much faster to test things easily (I get very annoyed by always having to type "/data @e[type=...,sort=nearest,limit=1]" when it could just be "/data @n"!)

     

    I wanted to suggest this too, but without the addition of excluding @s from the command, but I think this is way better.

  • 1
    Registered User commented
    Comment actions Permalink

    There's no reason to add this except to be lazy when there's @e[sort=nearest,limit=1]

  • 1
    Registered User commented
    Comment actions Permalink

    This should honestly be in the game, it just makes sense.

  • 0
    Registered User commented
    Comment actions Permalink

    Uhh, @e exists.... That literally does what you're asking for.

  • 0
    Registered User commented
    Comment actions Permalink

    I mean @p is just @a[sort=nearest,limit=1], it makes sense to have a short hand for @e[sort=nearest,limit=1] too, making @p just @n[type=player]. i think this is a cool idea tbf.

  • 2
    Registered User commented
    Comment actions Permalink

    Congrats, this was added in a recent snapshot 24w21a!