mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
* fix: persist item data components dropped on save `DataComponentImpl::write_data` defaults to returning `NbtTag::End`, so any component relying on that default serialized to nothing. `write_item_stack` walks the component patch and calls `write_data` on every entry, which meant those components were silently dropped whenever an item stack was written to NBT (chests, player inventories, chunk saves). Most of them already had a deserializer, so the data just vanished on the next save/load. Implement `write_data` for the data-carrying components that were missing it: MaxDamage, Enchantable, Food, Tool, BlockEntityData, Container and BundleContents. For the ones without a deserializer yet (MaxDamage, Enchantable, Food, Tool) add the matching `read_data` and register them in the `read_data` dispatcher so they round-trip through write_item_stack/ read_item_stack. The output follows the vanilla NBT shape for each component. Add round-trip tests for the scalar and compound cases. * test: use the assert_round_trip helper