Skip to content

Commit

Permalink
fix: 🐛 Fixed backpack render data to be properly serialized / deseria…
Browse files Browse the repository at this point in the history
…lized in data components
  • Loading branch information
P3pp3rF1y committed Dec 18, 2024
1 parent 54bd8bf commit 086df87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ loader_version_range=[4,)
mod_id=sophisticatedbackpacks
mod_name=Sophisticated Backpacks
mod_license=GNU General Public License v3.0
mod_version=3.20.26
mod_version=3.20.27
mod_group_id=sophisticatedbackpacks
mod_authors=P3pp3rF1y, Ridanisaurus
mod_description=Fancy and functional backpacks.
Expand All @@ -34,7 +34,7 @@ chipped_cf_file_id=5506938
resourcefullib_cf_file_id=5483169
athena_cf_file_id=5431579
curios_cf_file_id=5546342
sc_version=[1.21-0.7.10,1.22)
sc_version=[1.21-1.0.2,1.22)

#publish
curseforge_id=422301
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.component.CustomData;
import net.p3pp3rf1y.sophisticatedcore.init.ModCoreDataComponents;
import net.p3pp3rf1y.sophisticatedcore.renderdata.RenderInfo;

Expand All @@ -19,11 +20,11 @@ public BackpackRenderInfo(ItemStack backpack, Supplier<Runnable> getSaveHandler)

@Override
protected void serializeRenderInfo(CompoundTag renderInfo) {
backpack.set(ModCoreDataComponents.RENDER_INFO_TAG, renderInfo);
backpack.set(ModCoreDataComponents.RENDER_INFO_TAG, CustomData.of(renderInfo));
}

@Override
protected Optional<CompoundTag> getRenderInfoTag() {
return Optional.ofNullable(backpack.get(ModCoreDataComponents.RENDER_INFO_TAG));
return Optional.ofNullable(backpack.get(ModCoreDataComponents.RENDER_INFO_TAG)).map(CustomData::copyTag);
}
}

0 comments on commit 086df87

Please sign in to comment.