2

I'm having (for example) a entity (Drop) with this NBT:

{Item:{tag:{display:{Lore:["test1"]}},id:"minecraft:bread"}}

I'm trying to add a new lore:

/data merge entity @e[type=item,tag=myDrop] {Item:{tag:{display:{Lore:["test2"]}}}}

But when I execute this and collect my drop there is ONLY test2 as lore but i need test1 and test2. Please help! Thanks.

EDIT: I don't know the content and/or the count of test1.

EDIT2: So simply a array.append() but how in minecraft?

nift4
  • 61
  • 6

2 Answers2

2

1.14 introduces this feature using the "append" mode of /data modify:

/data modify entity @e[type=item,limit=1] Item.tag.display.Lore append value "{\"text\":\"second line\"}"
Fabian Röling
  • 20,534
  • 6
  • 38
  • 75
nift4
  • 61
  • 6
-1

Try

/data merge entity @e[type=item,limit=1] {Item:{tag:{display:{Lore:["test2","test1"]}}}}

You're still replacing the original test1, but you can just replace it with test1, or you could change it.

Hope this helps! :D

Brickly
  • 1
  • 1
  • Hi! Thanks for the answer, but I have an lore I don't know and only want to add mine.(I'm making a custom enchantment in a datapack that works but i cant add the enchantment desc as a lore). See question edit. – nift4 Oct 08 '18 at 17:33