How do I replace blocks around me as I move?
Christopher Martinez
Published May 09, 2026
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 3except fixed for 1.16.4 because I know jack about minecraft commands.
1 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.