2

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?

14
  • 1
    Did you try using /clear @p minecraft:tripwire_hook -1 1 {display:{Name:Key}}?
    – Schism
    Jul 28 '15 at 13:01
  • just tried it and no dice. This is supposed to be working right? is the clear command capable of testing for nbt tags at all?
    – mogulus
    Jul 28 '15 at 13:19
  • The third command in your post and the one Schism posted should work fine. What is the exact give command you're using to give yourself the key?
    – SirBenet
    Jul 28 '15 at 14:07
  • i'm using a command block to give myself the key as follows:
    – mogulus
    Jul 29 '15 at 10:03
  • /give @p tripwire_hook 64 {display:{Name:"Key",Lore:[Opens one door]}}
    – mogulus
    Jul 29 '15 at 10:09
2

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.

6
  • checked and rechecked. again, it does not work. are you playing on a server when you checked this or are you in single player?
    – mogulus
    Aug 11 '15 at 12:56
  • Singleplayer. If you are on a server, which kind of server is it?
    – Bagel
    Aug 11 '15 at 16:16
  • It's on a spigot server with minecraft 1.8.3
    – mogulus
    Aug 25 '15 at 2:35
  • 1
    That's exactly it. If you are running it with Essentials, /clear is overridden by the Essentials version of the command, in which you can't specify the item to clear from the player's inventory. I can't think of a solution off the top of my head to this problem, unless you could disable the command or use a different plugin apart from Essentials.
    – Bagel
    Aug 25 '15 at 18:07
  • 1
    Bagel, this solved the problem. If anyone else needs help with this, the solution was to go into my servers' "commands.yml" file and under "command block overrides" type - "*" . that makes the internal engine of the game look no further than vanilla hardcoded commands when running script from command blocks. This overrode the /clear command and theoretically any other command that has a plugin conflict or dependancy.
    – mogulus
    Sep 3 '15 at 13:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.