ItemHelper#get/setCustomData - controls an item's CUSTOM_DATA component, with get returning the item's NBT on older versions.
ItemHelper#setPartialOldNbt - sets pre-components NBT onto an item by running it through the DFU.
ItemTag.custom_data property - manages an item's custom data, replacing raw_nbt.
oldNbtPropertySlowWarning - for ItemTag.raw_nbt being deprecated in favor of custom_data.
Changes
ItemTag.raw_nbt has been updated to modern property format, and is now deprecated in favor of custom_data on 1.20+.
ItemScriptHelper#getItemScriptNameText/Container now use the new ItemHelper#getCustomData.
[!NOTE]
custom_data currently removes Denizen data from the value (as it's persisted elsewhere), and adds it back before setting to avoid it getting removed.
This seemed like the best way to impl it imo, as you can get/set the data as usual without the limitations raw_nbt had (e.g. not being able to remove keys), and matches how most properties work without risking Denizen data getting messed up, but lmk if you have any alternative ideas.
[!NOTE]
Clearing custom_data can probably be optimized a bit more then using the same denizen-key-adding setting custom data uses, but it's a niche enough use case to justify not getting into micro-optimzations (at least right now) imo.
[!NOTE]
raw_nbt is back-supported by running old values through the DFU - this is the best way I could find to not have old items being stored just break, which might not be perfect since it only gets partial NBT data, but seems to work well enough and is better than nothing.
Additions
ItemHelper#get/setCustomData
- controls an item'sCUSTOM_DATA
component, withget
returning the item's NBT on older versions.ItemHelper#setPartialOldNbt
- sets pre-components NBT onto an item by running it through the DFU.ItemTag.custom_data
property - manages an item's custom data, replacingraw_nbt
.oldNbtProperty
SlowWarning
- forItemTag.raw_nbt
being deprecated in favor ofcustom_data
.Changes
ItemTag.raw_nbt
has been updated to modern property format, and is now deprecated in favor ofcustom_data
on 1.20+.ItemScriptHelper#getItemScriptNameText/Container
now use the newItemHelper#getCustomData
.