clear item from player's inventory

clear item from player's inventory - Top view of metal pendulum device placed on white table in psychiatrical clinic
/summon Item ~ ~3 ~ {CustomName:"banana",CustomNameVisible:1,Item:{id:dye,Damage:11,Count:1,tag:{display:{Name:"banana",Lore:[Good to your body!]}}},Age:100000}

This command will drop a dye named "banana" and with Lore.

How do I use the /clear command to clear this item from a player's inventory?



Best Answer

/clear syntax:

/clear <player> [id] [Damage] [maximum amount] {dataTags}

The dataTags for /clear start directly within the tag compound, as the rest of the data (minus Count and Slot) is specified within the command's syntax already.

/clear @p minecraft:dye 11 -1 {display:{Name:"banana",Lore:[Good to your body!]}}

Your command itself is malformed. Age is a Short tag, with a range between -32768 and 32767, of which your input greatly exceeds this and will overflow to -31072. If the Age tag of an item is 6000 or higher, the item will despawn, which does not appear to be what you want to have happen.

You should not just toss in a random high value for data because it will not function as you expect it to.

If you want an item to never despawn, you can set it to -32768 which will cause it to be locked at that value.

/summon Item ~ ~3 ~ {CustomName:"banana",CustomNameVisible:1,Item:{id:"minecraft:dye",Damage:11s,Count:1b,tag:{display:{Name:"banana",Lore:["Good to your body!"]}}},Age:-32768s}



Pictures about "clear item from player's inventory"

clear item from player's inventory - Blackboard surrounded with cones and pebbles
clear item from player's inventory - Aerial Photography of Water and Rocks
clear item from player's inventory - Interior of modern kitchen in office



What is the command to clear items in Minecraft?

One of the most popular and fastest ways to clear items is the kill command. First, type /kill @e[type=item] in the chat and press enter to remove all dropped items in your Minecraft world instantly.



✔️ Minecraft: How To Check \u0026 Clear Items From Player Inventories! - (Command Block School Tutorial)




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Skylar Kang, Brett Sayles, Luciann Photography, Max Vakhtbovych