TransWikia.com

How do I replace blocks around me as I move?

Arqade Asked by Lemon demon on January 19, 2021

Basically I need a command that as I move it replaces all of one type of block. when I search up commands like this it always fails because I am in 1.16.4 and the commands are outdated. basically like this command:

execute @p ~ ~ ~ fill ~-2 ~-1 ~2 ~2 ~ ~-2 minecraft:glass 0 replace minecraft:wool 3

except fixed for 1.16.4 because I know jack about minecraft commands.

One Answer

Just put in a Repeating Command Block set to Always Active or in a Ticking function, the following command.

execute at <selector eg @p> run fill ~-5 ~-5 ~-5 ~5 ~5 ~5 <what block you want to replace with> replace <what block you want to replace>

This will replace any blocks that are x with a block that is y in a 10x10x10 box using z entities' location as the center. Make sure to change the entity selector to whatever you want, and the blocks to whatever you want. The selector @p selects the nearest player.

How it works

The execute at part runs the fill command at the entity's position who was selected with a selector. The ~'s in the fill command is used for using the run location as coordinates and you need one for each coordinate. The number after the ~'s is used for taking the run location and adding that number to it. There is a point where the volume of the fill box is too high that the command won't execute. That number is 32,768, which it isn't that high in terms of filling areas.

Correct answer by randomuser922 on January 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP