How do I swap two blocks with /clone?

How do I swap two blocks with /clone? - Numbers Wall Decor

I'm making a map in which you switch blocks around, but depending on the order you do it, I can't use /setblock or else it might set the wrong block. I know I can use /clone to clone one block and place it in another spot, but is it possible to do this to two blocks at the same time to switch their positions?



Best Answer

Use a temporary spot.

Designate a certain space (really anywhere, preferably underground in a spawn chunk) for the swap space. Then:

  1. /clone block A into the swap space.

  2. Clone block B into the spot where A was.

  3. Clone A into the spot where B was at the start.

Quick diagram (with clearing the swap space at the end)

_ A B
A A B
A B B
A B A
_ B A

Note: I say underground in a spawn chunk for 2 reasons:

  • Underground hopefully won't let anybody near it (idk if entities in the spot will break /clone.

  • If you don't place it in a loaded chunk, then it will have to load the chunk every time you move the block (causing lag). The spawn chunks are already loaded (permanently), so this won't cause a problem.




Pictures about "How do I swap two blocks with /clone?"

How do I swap two blocks with /clone? - 123 Cutout Decor on Red Surface
How do I swap two blocks with /clone? - Woman in White Karate Gi
How do I swap two blocks with /clone? - 2 Women in White Karate Gi



How do you replace one block with another in Minecraft?

In Minecraft, you can use the /fill command to replace a specific type of block with another. In this case, we want to replace all water blocks with air blocks within a fill range.

How do you clone one block in Minecraft?

Press Ctrl + C (Windows) or \u2318 Cmd + C (Mac). This keyboard combination will copy the highlighted text to your clipboard. Press Ctrl + V (Windows) or \u2318 Cmd + V (Mac) to paste. You can paste the copied text anywhere.

How do you copy and paste blocks in Minecraft?

replace - Replaces all blocks (including air) in the fill region with the specified block, without dropping blocks or block contents as entities.



Minecraft /CLONE Command Tutorial [1.19]




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Magda Ehlers, Magda Ehlers, olia danilevich, olia danilevich