2

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?

3

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.

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.