6

How do you clear 1 item from the inventory that has a custom name? What I'm trying to do is make a torch that when you hold it, it gives you Night Vision effect but after like 400 ticks or so I want the torch to run out of fuel and clear 1 torch away from the inventory, I have the potion effects (giving and taking away) working and the testfor command but how do I clear the item? this is my code I'm trying to use /clear @a torch 1 1 {display:{Name:"Special Torch"}}

  • 3
    +1 because you tried something :) Welcome to Arqade btw. – Ave Dec 2 '14 at 20:25
4

The syntax for clear is as following:

/clear [player] [item] [data] [maxCount] [dataTag]

Your command is as following:

/clear @a torch 1 1 {display:{Name:"Special Torch"}}

You are trying to clear (for everyone in the server) torches with a data value of 1, a max count of 1 and a name of "Special Torch".

Seeing as there are no torches with a data value of 1, try using the following:

/clear @a torch 0 1 {display:{Name:"Special Torch"}}
  • Thank you I thought I was using syntax incorrectly it turned out I used the wrong data – Veritas025 Dec 3 '14 at 21:38

protected by Community Dec 17 '17 at 5:22

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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