Arqade Asked by Gulpinator on December 31, 2020
So, the command block should say ‘Minecraft’ only if a player stands at ‘xyz: 0 20 0’. But it does so no matter where I stand. Could somebody tell me what I did wrong and fix this command please?
/execute if entity @p positioned 0 20 0 run say Minecraft
I’m playing on a single player creative world on Minecraft Java Edition 1.16.3.
There is an easier way to do this using selectors:
/execute as @p[x=0.5,y=20.5,z=0.5,distance=..1] run say Minecraft
(The x=
, y=
, and z=
aren't strictly necessary.)
Conversely, you could also specify the volume of the search space like so:
/execute as @p[x=0,y=20,z=0,dx=1,dy=1,dz=1] run say Minecraft
Answered by MBraedley on December 31, 2020
You thought the command would say, "If there is a player positioned at 0 20 0, say Minecraft."
However, it actually says, "Locate the nearest player; if one is found, make the command execute positioned at 0 20 0: say Minecraft"
/execute positioned 0 20 0 if entity @p[distance=..1] run say Minecraft
This command says "Execute this command positioned at 0 20 0: locate the nearest player within 1 block radius of the command's execution position; if one is found, say Minecraft".
Answered by ginkgo on December 31, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP