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?
Minecraft – How to swap two blocks with /clone
minecraft-java-edition
Related Topic
- minecraft-java-edition,minecraft-commands – Join Two Lines Of Conditional Chain Command Blocks Without Redstone In Minecraft
- Minecraft – How to use a command block to add coordinates to another command block
- Minecraft – How to swap two inventory slots dynamically
- Minecraft Commands – How to Make Blocks Placeable on Any Blocks in Adventure Mode with Shorter Command
- Minecraft – In Minecraft, How to create floating grass with command blocks
Best Answer
Use a temporary spot.
Designate a certain space (really anywhere, preferably underground in a spawn chunk) for the swap space. Then:
/clone
block A into the swap space.Clone block B into the spot where A was.
Clone A into the spot where B was at the start.
Quick diagram (with clearing the swap space at the end)
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.