I've been trying to get the text from the lore of the item in the main hand and store it as a score value:

execute as @p store result score @s kC run data get entity @s SelectedItem.tag.display.Lore ...

But I have no idea how to continue the path to get the text as an output

1 Answer 1


I've found a solution to the problem by developing more steps:

  1. As the text in the lore comes from a scoreboard value, I stored the score as an impossible enchantment for the item (a stick in my case), so that existing ones don't get overwritten, using the item modifier set_enchantments.

  2. Copy-paste the enchantment level in a custom tag (Durability in my case), using the item modifier: copy_nbt ("source": "SelectedItem.tag.Enchantments.[{id:\"minecraft:Your_enchantment\"}].lvl") ("target":"Your custom Tag"), using replace as the operation.

  3. Remove the enchantment to prevent the unwanted glint on the item by using the item modifier set_enchantments, setting the enchantment level to 0.

And this is all so that you can then access the value stored in the item with the path SelectedItem.tag.YourCustomTag.

You must log in to answer this question.

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