Is there a way to clone with the relative coordinates of a player and the command block? I am trying to make a "one-command-creation" with those two things. I am in 1.12. Like /clone {Relative coords of command block} {Relative coords of player}
-
Arqade usually works better when you can show us something that you've tried so far. At the moment, this is more of a request than a question.– Timmy Jim ♦Commented Jul 16, 2017 at 19:39
-
What exactly are you trying to do? Coordinates are no entities or blocks, you can't clone them.– Fabian RölingCommented Jul 16, 2017 at 20:53
-
I still don't know what you want to do. Can you give an example?– Fabian RölingCommented Jul 17, 2017 at 10:18
-
Ah, ok, you want to clone an area that is relative to one variable location to another variable location. Got it. I'll write an answer…– Fabian RölingCommented Jul 17, 2017 at 19:14
-
@Unknown Did you delete your comments? Now people can only see one side of this conversation. Please don't do that.– Fabian RölingCommented Aug 10, 2017 at 18:03
2 Answers
It sounds to me like you're trying to clone from a location relative to a command block to a location relative to the player. As Fabian says, ~
is for relative coordinates. Specifically, relative coordinates are relative to the executor of the command. When a command block runs a command, the command block is the executor. When you run a command in chat, you are the executor. So both entities and blocks can be the executor. To do anything from a command block relative to the player, you will have to use the command block to make the player the executor, which is done using the /execute
command.
The catch here, of course, is that since /clone
is a single command, it can only be executed relative to a single executor. So you will either need to first clone from relative to the command block to an intermediary location addressed using absolute coordinates, and then /execute
at the player to clone from there to beside them, or execute everything relative to the player in the first place.
To clone an area from one variable location to another location, you can first clone it to some coordinates you know, then from there to where you want to have it and then delete the middle copy. So for example to clone a 10x10x10 area with the player Horst as the lowest x, y and z coordinate to another area with the player Herbert as the lowest x, y and z coordinate you can use the following commands:
/execute at @p[name=Horst] run clone ~ ~ ~ ~9 ~9 ~9 0 245 0
/execute at @p[name=Herbert] run clone 0 245 0 9 254 9 ~ ~ ~
/fill 0 245 0 9 254 9 air
Keep in mind that you delete everything in the area from 0 254 0 to 9 254 9, so make sure to choose an area with nothing (important) in it.