How can I reach a lore text?
-
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
-
I've found a solution to the problem by developing more steps:
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
.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.Remove the enchantment to prevent the unwanted glint on the item by using the item modifier
set_enchantments
, setting the enchantment level to0
.
And this is all so that you can then access the value stored in the item with the path
SelectedItem.tag.YourCustomTag
.