mojira.dev
MC-126688

/execute as in 18w09a in datapacks

to reproduce:
make a datapack with a function, any name will do.
in this function, paste this line:
say nearest to me: @e[sort=nearest,type=!player,limit=1]
put down any command block and paste this line:
execute as @p run function namespace:function
now, put any entity close to this command block except players
go away so you can have a different entity close to you
activate the command block by any means
it should say:
[your name here] nearest to me: <entity near command block>
correct output SHOULD be:
[your name here] nearest to me: <something actually near you>

the screenshot attached demonstrates this.

Attachments

Comments 2

It's intentional, you need to use /execute as @p at @s run function <namespace>:<function>

Julian Scheffers

(Unassigned)

Unconfirmed

Minecraft 18w09a

Retrieved