Skip to content

Commit

Permalink
Add null check to DimensionDataStorage. Fixes #9859
Browse files Browse the repository at this point in the history
  • Loading branch information
LexManos committed Feb 2, 2024
1 parent aa6f268 commit 5d00477
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -58,7 +57,7 @@ public static LevelCapabilityData compute(DimensionDataStorage data, @Nullable I
ret.read(tag);
return ret;
},
DataFixTypes.SAVED_DATA_COMMAND_STORAGE //TODO: Hook this for our own types?
null
);

var ret = data.computeIfAbsent(factory, ID);
Expand Down

0 comments on commit 5d00477

Please sign in to comment.