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
This commit is contained in:
parent
50c77f7bb8
commit
4e2574a147
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user