Clearing Items with NBT Tags

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.

  • How to control where items get stored?
  • Minecraft Command Blocks Help - Selecting previous target in a second command block
  • Can mobs spawn on slabs?
  • How can I clear the water out of this area?
  • Why do I keep timing out on Minecraft multiplayer servers?
  • Which mobs can I out-run?
  • 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?

  • Does the hunger meter decrease at a constant rate?
  • I'm stuck underground. How do I get back to the surface?
  • How do I move a Minecraft saved world from my desktop to my server?
  • What is a 'chunk'?
  • In my first game I spawned on a small island. What do I do next?
  • How to install a FTB modpack from a zip file to a MultiMC instance of Minecraft?
  • One Solution collect form web for “Clearing Items with NBT Tags”

    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.

    We love Playing Games, especially Video Games.