Minecraft-Java-Edition – How to Delete ALL Barrier Blocks within 10 Blocks of Player with Command Blocks

minecraft-java-edition

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.12−

execute @a ~ ~ ~ fill ~-10 ~-10 ~-10 ~10 ~10 ~10 air 0 replace barrier

That should clear a 20x20x20 blocks cube around the player of any barrier blocks.