How do you use the player-sensing command in Minecraft Bedrock?
Solution 1:
Again, this is a question regarding entity coordinates testing, detecting if player is within a certain block region. It can be achieved by using volume selectors.
You see, within the entity selector (@e[nbt={},....]) there are parameters called volume selectors which include x=, dx=, y=, dy=, z=, dz=
. These may look complicated but they are used almost the same way you use the /fill command. x=, y=, z=
represent the starting coordinates of a block region, and dx, dy, dz
refer to the coordinates displacement, not the ending coordinates. Ending coordinates should be (x+dx,y+dy,z+zy)
.
Eg: I want to detect if a player is standing in a cubic region starting (10, 10, 10) to (20, 20, 20).
execute as @a[x=10,y=10,z=10,dx=10,dy=10,dz=10] run say wowiamincube
Eg: It is possible to limit the detection to a single block as well. Just put in the x, y, z
coordinates and set the displacements as 0.
Now the only thing left is to insert your fill command after the /execute run code
After the player left the door zone however, use the /execute unless
command to fill the door back up the way you opened it