Skip to content

Commit

Permalink
Fix wiki and update the datafixer
Browse files Browse the repository at this point in the history
  • Loading branch information
tr7zw committed Jun 20, 2024
1 parent ac84a4d commit 522f732
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

public class DataFixerUtil {

// these values can be found in DetectedVersion inside mc
// Finding pre 1.12.2 values is left as an exercise for the reader,
// as DetectedVersion is not a thing there
public static final int VERSION1_12_2 = 1343;
public static final int VERSION1_16_5 = 2586;
public static final int VERSION1_17_1 = 2730;
Expand All @@ -26,6 +29,7 @@ public class DataFixerUtil {
public static final int VERSION1_20_2 = 3578;
public static final int VERSION1_20_4 = 3700;
public static final int VERSION1_20_5 = 3837;
public static final int VERSION1_21 = 3953;

@SuppressWarnings("unchecked")
public static Object fixUpRawItemData(Object nbt, int fromVersion, int toVersion)
Expand Down Expand Up @@ -58,7 +62,9 @@ public static ReadWriteNBT fixUpItemData(ReadWriteNBT nbt, int fromVersion, int
* @return
*/
public static int getCurrentVersion() {
if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_20_R4)) {
if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_21_R1)) {
return VERSION1_21;
} else if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_20_R4)) {
return VERSION1_20_5;
} else if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_20_R3)) {
return VERSION1_20_4;
Expand Down
2 changes: 1 addition & 1 deletion wiki/Using-the-NBT-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ You can refer to [NBTHandlers](https://github.com/tr7zw/Item-NBT-API/blob/master

### Data fixer utils

``DataFixerUtil`` allows updating nbt from versions since 1.12.2 to more recent ones.
``DataFixerUtil`` allows updating nbt from older versions to more recent ones.

For example, given the input from 1.12.2:

Expand Down

0 comments on commit 522f732

Please sign in to comment.