Skip to content

Commit

Permalink
Add legacy data version reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Oct 9, 2024
1 parent f2a8881 commit e3f0d1f
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ public static String getKeyFromMetadata(ModContainer mod) {
@Contract(pure = true)
@Range(from = 0, to = Integer.MAX_VALUE)
public static int getModDataVersion(CompoundTag nbt, String modId, @Nullable String key) {
// LEGACY
String legacyKey = modId + "_DataVersion";
if (key != null) {
legacyKey += ('_' + key);
}
if (nbt.contains(legacyKey)) {
return nbt.getInt(legacyKey);
}

// FABRIC
String nbtKey = modId;

if (key != null) {
Expand Down

0 comments on commit e3f0d1f

Please sign in to comment.