For a new command block creation, I've got the idea for a constant test for a bat, so when it's spawned, it'll die instantly, and the /clone
command will clone a house from a location to near the player. The thing is, I don't know how to make the /clone
command paste in the house near the player, as ~# ~# ~#
works using it in a command, but a command in a command block doesn't work.
Is there a way to do this?
Best Answer
Relative coordinates (
~#
) are relative to the thing that's executing the command. As an example, if~ ~5 ~
is in a command block, it will target 5 blocks above the command block.To have the command in a command block, but have the coordinates relative to a player, you should use the
/execute
command. The syntax of it is:So, for your problem, you'll likely want to do something like this:
Replacing
<X1>
,<Y1>
, etc. with the original coordinates of the house, and the#
's with the offset you want it to be cloned to relative to the player (@p
).