Feature Request: Make Nbt merging configurable concerning list merge behaviour (add/replace)
elhertz opened this issue ยท 8 comments
Version
Minecraft 1.14.2 / Mod 1.1.16+1.14.2 / Fabric loader build.7
Describe the bug
After making the json, and when the ingredient item is named (by anvil), the lore I set in the config will duplicate and this is the result:
https://i.imgur.com/Lp0F5Li.png
Same procedure without changing the name of the ingredient:
https://i.imgur.com/hw2qSdi.png
To Reproduce
- This is my json
https://pastebin.com/T9C7cJ3D - Try to add a lore to a renamed item
Expected behavior
I'm trying to add a lore to an item without modifying its name, damage and enchantments.
Log
No errors, I'm using https://jsonformatter.curiousconcept.com/
Additional context
I'm using functions that detect the lore of the items and add potion effects.
What am I doing wrong? is it me? is it the mod?
Regards.
@Nathan22211 Nah... the old nbt will always be kept when merging lists.
(This thread is specifically about the merge behaviour of lists - Normal merging should work fine)
well from my testing when you have a recipe ingredient and result that uses the same tag e.g. {Enchant:["L"]}
as the ingredient and {Enchant:["P"]}
as the result it doesn't add P to the list like {Enchant:["L","P"]}
but instead clears the list and I just end up with {Enchant:["P"]}
in my scenario.
@Nathan22211 Seems like I forgot that as I already implemented it in the 2.0 branch.
With 2.0 Nbt-Crafting will merge by default and overwrite if you specify it with "$overwrite": true
.
I'm open for feedback again as my current solutions is flawed for lists. (lists may only consist of one data type in nbt data)
Summary:
We need a system that allows to either:
- add the new items to the existing list
- completely overwrite the existing list
- merge the list elements with each other (
[{a:1}]
+[{b:2}]
=[{a:1, b:2}]
)
Similar approach is needed for objects.
That is some kind of a missing feature rn.
The mod will merge nbt data meaning it merges lists too (keeps the old elements).
I'm not quite sure yet how I'm going to solve this problem.
I finally fixed this!
If you want to use the new nbt merging then go ahead and ask me as there's currently no documentation for it.
See me at the discord for that ;)
I wrote some documentation for it in the wiki.
As always, if you're having trouble - check the discord out ;)