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 Answers 3


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
    Commented Dec 3, 2014 at 21:38
  • 1
    THIS ANSWER IS OUTDATED. This answer is for 1.12-. If you are playing in 1.13+, use the below answer instead.
    – One 2 Many
    Commented Nov 29, 2020 at 19:41

The accepted answer is now outdated. Please read this answer if you are playing in 1.13+.

1.13+ Update

The syntax of the clear command changed in version 1.13; the NBT data is now incorporated into the item parameter, the data value has been removed, and JSON formatting has been added to the Name The updated command would now be the following:

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

You can omit the count (last parameter) to clear all items that match.


1.20.5 syntax:

/clear @a minecraft:torch[minecraft:custom_name='{"text":"Special Torch"}']


/clear @a minecraft:torch[minecraft:item_name='{"text":"Special Torch"}']

Depending on which component you used when you gave the item. Anvil names use the former, and if you're using a custom component you really should use custom_data anyway.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .