2

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?

5
  • 3
    Can you please give us the specific commands you are using? Right now we won't be able to help you at all because it's a bit unclear what you are doing. Commented Jan 1, 2016 at 22:03
  • 1
    A recent edit changed the whole question with the justification "to fit my needs", doesn't this conflict with the autor intent?
    – pinckerman
    Commented Dec 31, 2016 at 1:21
  • @pinckerman I was kinda skeptical about this too. That's why I did cast a reopen vote to let people judge about FIRE_of_ETERNITY edit. Else, and most probably, we can just rollback to the original question.
    – Izuka
    Commented Dec 31, 2016 at 2:13
  • 1
    @Isuka Considering that the original question has an answer (which was accepted) probably a rollback is a good solution. But I think that the question can be reopened anyway.
    – pinckerman
    Commented Dec 31, 2016 at 2:36
  • 1
    @pinckerman Seems like the best option there. Rollback done.
    – Izuka
    Commented Dec 31, 2016 at 2:37

1 Answer 1

3

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:

/execute <entity> <x> <y> <z> <command …>

So, for your problem, you'll likely want to do something like this:

/execute @p ~ ~ ~ /clone <X1> <Y1> <Z1> <X2> <Y2> <Z2> ~# ~# ~#

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.