I'm running a server for a group of friends with a significant number of custom items which give an effect when in the player's inventory (NOT just when held, which minecraft supports natively). Unfortunately, the command block /execute processes for these commands are quite expensive, even with optimizations like Lithium. This is one example of a command I'm currently using, ran in a repeating command block targeting an item with a custom texture:
/execute if @a[nbt={Inventory:[{id:"minecraft:raw_gold",display:{Name:'{"Cursed Ruby"}',Lore:['{"text":"When In Inventory:","color":"gray"},{"text":" Blindness","color":"red"}']}}]}] at @a[nbt={Inventory:[{id:"minecraft:raw_gold",display:{Name:'{"Cursed Ruby"}',Lore:['{"text":"When In Inventory:","color":"gray"},{"text":" Blindness","color":"red"}']}}]}] run effect give @p minecraft:blindness 5 1 true

Selector is below:

    Name:'{"Cursed Ruby"}',
     {"text":"When In Inventory:","color":"gray"},
     {"text":"  Blindness","color":"red"}

With around 20 similar items in numerous quantities across multiple player inventories, this gets expensive fast. You might notice that I've attempted using an if keyword to reduce the impact of the command; it seems to have helped a little bit, but this is still taking roughly 40% of my server's resources.

Is there a way to minimize the performance impact of inventory-based checks, similar to how Minecraft's native When In Hand applies it? I can use mods if necessary, but a vanilla solution is preferred.


1 Answer 1


There is a plugin named ItemEdit and there is an addon for it named ItemTag. With that plugin you can make that work.

  • 1
    Can you be more specific?
    – Joachim
    Commented Feb 25 at 14:06
  • you mean how to do the commands for it or just the anwser
    – lars games
    Commented Feb 25 at 14:08
  • You seem to be pointing in the right direction (I'm not very familiar with Minecraft), but don't really seem to address the specific issue the OP is having, or explain how this will help minimize performance.
    – Joachim
    Commented Feb 25 at 14:33
  • what do you mean with that
    – lars games
    Commented Feb 29 at 16:25

You must log in to answer this question.

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