From 4e2574a14793c5e05f1a937314af14812fc32fcf Mon Sep 17 00:00:00 2001 From: laforetbrut Date: Thu, 26 Mar 2026 19:30:27 +0100 Subject: [PATCH] Fix RS2 disk save: use return value of SavedData.save() save() returns the serialized data in a NEW CompoundTag - it does NOT fill the input parameter. We were passing an empty tag and reading it back, getting nothing. The actual data was in the return value. Log showed: "RS2 disk UUID xxx exists in repo but NOT found in save() NBT. Keys at top: []" - empty because we ignored the return value. Vyrriox --- .../java/vip/fubuki/playersync/sync/addons/ModsSupport.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/vip/fubuki/playersync/sync/addons/ModsSupport.java b/src/main/java/vip/fubuki/playersync/sync/addons/ModsSupport.java index 99a7853..10af369 100644 --- a/src/main/java/vip/fubuki/playersync/sync/addons/ModsSupport.java +++ b/src/main/java/vip/fubuki/playersync/sync/addons/ModsSupport.java @@ -456,8 +456,8 @@ public class ModsSupport { // Use save() to serialize the in-memory state to a CompoundTag (does NOT touch disk) if (!(repo instanceof net.minecraft.world.level.saveddata.SavedData sd)) return; - net.minecraft.nbt.CompoundTag fullNbt = new net.minecraft.nbt.CompoundTag(); - sd.save(fullNbt, sp.getServer().registryAccess()); + // FIX: save() RETURNS the data in a new CompoundTag, it does NOT fill the input parameter + net.minecraft.nbt.CompoundTag fullNbt = sd.save(new net.minecraft.nbt.CompoundTag(), sp.getServer().registryAccess()); // Log the top-level structure once for debugging PlayerSync.LOGGER.debug("RS2 save() NBT keys: {}", fullNbt.getAllKeys());