Clear inventory if player has two of the same unstackable item in inventory?

by OnePointZero   Last Updated January 13, 2018 19:14 PM

I'm trying to clear the player's inventory of an unstackable item if they have two of them in their inventory. This is a system to prevent duplication, while at the same time guaranteeing they still have this item and can't get rid of it.

The problem is, using an nbt tag selector for if the player has this item in their inventory only works for one item. Writing another entry within this nbt tag selector (like {Inventory:[{id:"minecraft:example"},{id:"minecraft:example"}]}) still treats it like one item and using {id:"minecraft:example",Count:2b} doesn't work either since these items can't be stacked.

How can I make this work the way I want it to? I'd rather not make 600+ different nbt tag selectors for each combination of possible {Slot:#b}'s if I can avoid it. It'd be really helpful if we had the new /modifyitem command, but right now it's still far off.



Related Questions



How to make a map

Updated December 27, 2017 04:14 AM