Snapshot 24w09a NBT Changes
Closed this issue · 3 comments
Edit 25.03.2024: Just found out that components are way bigger of a change, see comment below.
The recent snapshot 24w09a broke the entire datapack by randomly changing how NBT tags are formatted. This was done for "Performance improvements" and to make it more reliable in the future, but I don't really see how these changes are anything but annoying. Anyways, basically all loot tables that have NBT tags for their items need to be redone, so here`s a list of what changed in each loot table:
command_blocks.json: No changes
enchanted_books.json: {StoredEnchantments:[{id:bane_of_arthropods,lvl:1}]} => stored_enchantments={levels:{'minecraft:bane_of_arthropods':1}}
goat_horns.json: {instrument:"minecraft:ponder_goat_horn"} => instrument='minecraft:ponder_goat_horn'
lingering_potions.json: {Potion:"minecraft:strength"} => potion_contents={potion:'minecraft:strength'}
normal_items.json: No changes
other_items.json: No changes
paintings.json: {EntityTag:{variant:"minecraft:alban"}} => entity_data={variant:'minecraft:alban'}
potions.json: {Potion:"minecraft:strength"} => potion_contents={potion:'minecraft:strength'}
spawn_eggs.json: No changes
splash_potions.json: {Potion:"minecraft:strength"} => potion_contents={potion:'minecraft:strength'}
suspicious_stews.json: {Effects:[{EffectId:8,EffectDuration:120}]} => suspicious_stew=[{id:'minecraft:jump_boost',duration:120}]
tipped_arrows.json: {Potion:"minecraft:strength"} => potion_contents={potion:'minecraft:strength'}
As you can probably see, all of these changes are pretty small and only affect formatting, yet they require rewriting a bunch of code. FOrtunately, because these changes are all quite similar, they can be done using a script/tool, which takes the values out of the old tags and puts them into the new ones. I will soon provide a tool which can be used to update existing datapacks to the 24w09a changes. Please note that this tool will most likely only work with datapack made for 1.20.4+ because of the structure.
To-Do for RIG Snapshot 24w09a Updater Software:
- Fix final issues and exceptions
- Improve completion message
- Add about window
- Add notice which datapacks it works best with
- Finalize AssemblyInfo
- Add comments
- Upload both exe file and code to RIG repository, under a new folder "tools"
- Fix paintings not being converted correctly
Turns out Mojangs documentation on their new components changes is absolutely incomplete. Not once was mentioned that components in loot tables have to be structured completely different from how they appear ingame. While I thought they'd just go into the NBT tag field from before, they need a whole new JSON array. The tool for converting the loot tables is basically done, I only need to redo half of the software because they new syntax is way more complicated. Shouldn't be too hard though as the base is already there. Still, this is bullshit in my opinion. Thank you Mojang for this amazing change!
The update of the tool is now done and I'm close to releasing it. The conversion is working perfectly, I'm just fixing some edge cases and adding some information here and there. You can see a to-do list in the issue above.
The software is now done and can be downloaded for you to update your own Random Item Giver datapacks: https://github.com/Seeloewen/Random-Item-Giver-Datapack/raw/main/Tools/RIG%2024w09a%20Updater/Builds/RIG%2024w09a%20Updater%201.0.0.exe
The official Random Item Giver has also been fixed and now uses the new components. The changes will ship with the next beta.