TransWikia.com

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

Arqade Asked by Zoey Globe on July 30, 2021

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?

2 Answers

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.

Correct answer by Vovalium on July 30, 2021

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.

Answered by user264358 on July 30, 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