Add null check to DimensionDataStorage. Fixes #9859

This commit is contained in:
LexManos committed 2024-02-02 12:50:09 -08:00
1 parent aa6f268c74
commit 5d0047753d
2 files changed
+10 -2

No files matched your search

@@ -14,3 +14,12 @@
}
return (T)saveddata;
@@ -94,7 +_,7 @@
}
int i = NbtUtils.getDataVersion(compoundtag, 1343);
- compoundtag1 = p_301060_.update(this.fixerUpper, compoundtag, i, p_78160_);
+ compoundtag1 = p_301060_ == null ? compoundtag : p_301060_.update(this.fixerUpper, compoundtag, i, p_78160_); // Forge: Allow the data fixer to be null, leaving the modder responsible for keeping track of their own data formats
}
return compoundtag1;
@@ -6,7 +6,6 @@
package net.minecraftforge.common.util;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.datafix.DataFixTypes;
import net.minecraft.world.level.saveddata.SavedData;
import net.minecraft.world.level.storage.DimensionDataStorage;
@@ -58,7 +57,7 @@ public class LevelCapabilityData extends SavedData {
ret.read(tag);
return ret;
},
DataFixTypes.SAVED_DATA_COMMAND_STORAGE //TODO: Hook this for our own types?
null
);
var ret = data.computeIfAbsent(factory, ID);