How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks?

How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks? - Wooden Blocks with Numbers and Letters

I followed this video to get a system to allow players to fly in survival mode:

I modified the system by giving it a "toggle item' that allows the player to disable flying whenever they find it annoying or otherwise unwanted.

Sometimes whenever I use the toggle item the barrier block gets removed and the player falls to the ground as intended, but other times the barrier block remains and stays in the air, which means there's floating invisble blocks in midair, which is incredibly unwanted.

I'd prefer to just delete all barrier blocks within 10 blocks of the player whenever they stop flying, so I'd like you clever folks to help me.

How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks?



Best Answer

1.13 Update

/execute as @a at @a fill ~10 ~10 ~10 ~-10 ~-10 ~-10 air replace barrier

You can replace the @a with @p or any player, or @a[nbt=] or @a[tag=] whatever you really want.

The absolute value of the number after any tilde (~) in the command is the radius around the player in which it will fill barrier blocks. Hopefully this helps, this is also a command with the format of the newer versions, so it won't work on old versions like 1.8.




Pictures about "How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks?"

How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks? - Gray Concrete Blocks
How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks? - Colorful Circular Blocks
How do I delete ALL Barrier blocks within 10 blocks of the player with command blocks? - A Road Block on the Street



What is the command to remove a barrier block in Minecraft?

1 Answer
  • Its actually /fill [X1] [Y1] [Z1] [X2] [Y2] [Z2] air replace [Block To Remove]. ...
  • replace is not a command for block minecraft:air (or whatever) ...
  • This worked: /fill [X1] [Y1] [Z1] [X2] [Y2] [Z2] air 0 replace [Block To Remove] digminecraft.com/game_commands/fill_replace_water.php.


  • Is there a way to delete all of one block in Minecraft?

    Mine a Large Area InstantlyType the command in the chat window and press the Enter key to run the command. This /fill command would replace all blocks in the fill region, including air. The replaced blocks will be dropped and can then be collected as if they were mined with a pickaxe or shovel.



    How To Execute The Fill/Remove Command in Minecraft Bedrock




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

    Images: Hanna Auramenka, Smadar Bergman, Ann H, Vitaly Kushnir