0


This is my current command:
execute as @a[distance=..100] run execute at @s if block ~ ~-1 ~ minecraft:quartz_block run /clear @s <...>
I would like to clear the executing entity's inventory of all items without the NBT tag {PitAllow:1b}.
I am in version 1.15.2 and if any plugins are required (Bukkit or Spigot) I'd be fine with installing those.

1

You'll need one command per slot:

/execute unless entity @s[nbt={Inventory:[{Slot:0b,tag:{PitAllow:1b}}]}] run replaceitem entity @s hotbar.0 air
…
/execute unless entity @s[nbt={Inventory:[{Slot:8b,tag:{PitAllow:1b}}]}] run replaceitem entity @s hotbar.8 air
/execute unless entity @s[nbt={Inventory:[{Slot:9b,tag:{PitAllow:1b}}]}] run replaceitem entity @s inventory.0 air
…
/execute unless entity @s[nbt={Inventory:[{Slot:35b,tag:{PitAllow:1b}}]}] run replaceitem entity @s inventory.26 air
/execute unless entity @s[nbt={Inventory:[{Slot:-106b,tag:{PitAllow:1b}}]}] run replaceitem entity @s weapon.offhand air

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.