Clearing Items with NBT Tags [duplicate]
![Clearing Items with NBT Tags [duplicate] - Photo Of Creative Process Of Blue Eggs Clearing Items with NBT Tags [duplicate] - Photo Of Creative Process Of Blue Eggs](/assets/images/clearing_items_with_nbt_tags_duplicate_0.jpeg)
I'm making an adventure map in Minecraft.
I've been trying to make a key that opens a door and then deletes itself from your inventory. I got it to work flawlessly without NBT tags, using a trip-wire hook as a key.
After I assigned NBT tags to it thusly,
tripwire_hook {display:{Name:"Key",Lore:["Opens one door"]}
} the tripwire is now called a "Key" and describes exactly what it does and it even works to open the door. The command block that tests for the key in the players hand still works.
Unfortunately, the /clear @p
command block will not recognize the item whether I add the NBT tag after "tripwire_hook" or not. Here is the command that I've used:
/clear @p tripwire_hook 1 {display:{Name:"Key",Lore:["Opens one door"]}}
Just to be safe, I tried the following:
/clear @p tripwire_hook 1 1 {display:{Name:"Key",Lore:["Opens one door"]}}
/clear @p tripwire_hook 0 1 {display:{Name:"Key",Lore:["Opens one door"]}}
And it will still not clear the item.
I'm using Minecraft 1.8.3. Can anyone please advise?
Best Answer
I gave myself a tripwire hook using the exact same NBT tag in Minecraft 1.8.3. After trying a few times, I was able to use this command to clear the tripwire hook:
/clear @p tripwire_hook 0 1 {display:{Name:"Key",Lore:["Opens one door"]}}
As the format is:
/clear [player] [item] [data] [maxCount] [dataTag]
Your problem is that you are running Bukkit/Spigot with the Essentials plugin, so /clear
is overridden by the Essentials version of the command which doesn't allow you to specify the item to clear from the player's inventory.
You can prevent command blocks from using plugin commands by opening commands.yml
and setting command block overrides
to *
. That makes the internal engine of the game look no further than vanilla hardcoded commands when running script from command blocks.
Pictures about "Clearing Items with NBT Tags [duplicate]"
![Clearing Items with NBT Tags [duplicate] - Photo Of Creative Process Of Blue Eggs Clearing Items with NBT Tags [duplicate] - Photo Of Creative Process Of Blue Eggs](/assets/images/clearing_items_with_nbt_tags_duplicate_1.jpeg)
![Clearing Items with NBT Tags [duplicate] - A Person Buying From a Grocery Clearing Items with NBT Tags [duplicate] - A Person Buying From a Grocery](/assets/images/clearing_items_with_nbt_tags_duplicate_2.jpeg)
![Clearing Items with NBT Tags [duplicate] - Free stock photo of abstract, ancient, antique Clearing Items with NBT Tags [duplicate] - Free stock photo of abstract, ancient, antique](/assets/images/clearing_items_with_nbt_tags_duplicate_3.jpeg)
How do I delete NBT data?
You can use the /data command to get, merge and remove NBT tags (formerly called data tags) for entities and block entities. The /data command is most useful for changing attributes of a mob after the mob has spawned or modifying attributes of a block entity after you have placed it.How do I change the NBT data of an item?
1.16\u2212 An interesting workaround to change NBT of a custom item is to copy it to a chest, modify it in the chest (where it can be modified) and then use /loot in replace mode to replace the item slot. Note: Once 1.17 fully comes out, you can replace this method with the /item command.How do I get multiple NBT tags?
The NBT tag is always surrounded in {} such as {NoAI:1}. If there is more than one NBT tag used in a command, the NBT tags are separated by a comma such as {NoAI:1, IsBaby:1}. Each entity (or mob) has its own unique set of NBT tags. Select an entity to see the NBT tags that you can change.Minecraft TAG Command Tutorial [Working 1.19]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Olya Kobruseva, Olya Kobruseva, Julia Avamotive, Yan Krukov