Clearing Items with NBT Tags [duplicate]
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?
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.