java.lang.Object
org.quiltmc.qsl.frozenblock.misc.datafixerupper.api.QuiltDataFixes

public class QuiltDataFixes extends Object
Provides methods to register custom DataFixers.

Modified to work on Fabric

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final BiFunction<Integer,com.mojang.datafixers.schemas.Schema,com.mojang.datafixers.schemas.Schema>
    A "base" version 0 schema, for use by all mods.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    buildAndRegisterFixer(@NotNull net.fabricmc.loader.api.ModContainer mod, @NotNull QuiltDataFixerBuilder dataFixerBuilder)
    Builds and registers a new data fixer.
    static void
    buildAndRegisterMinecraftFixer(@NotNull net.fabricmc.loader.api.ModContainer mod, @NotNull QuiltDataFixerBuilder dataFixerBuilder)
    Builds and registers a new data fixer for use with Minecraft version-specific datafixing.
    static com.mojang.datafixers.DataFixer
    buildFixer(@NotNull QuiltDataFixerBuilder dataFixerBuilder)
    Builds a new data fixer.
    static @NotNull Optional<com.mojang.datafixers.DataFixer>
    getFixer(@NotNull String modId)
    Gets a mod's Minecraft version-specificdata fixer.
    static @NotNull Optional<com.mojang.datafixers.DataFixer>
    getMinecraftFixer(@NotNull String modId)
    Gets a mod's Minecraft version-specific data fixer.
    static @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int
    getModDataVersion(@NotNull net.minecraft.nbt.CompoundTag compound, @NotNull String modId)
    Gets a mod's Minecraft version-specific data version from a CompoundTag.
    static @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int
    getModMinecraftDataVersion(@NotNull net.minecraft.nbt.CompoundTag compound, @NotNull String modId)
    Gets a mod's Minecraft version-specific data version from a CompoundTag.
    static boolean
    Checks if the data fixer registry is frozen.
    static void
    registerFixer(@NotNull String modId, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull com.mojang.datafixers.DataFixer dataFixer)
    Registers a new data fixer.
    static void
    registerFixer(@NotNull net.fabricmc.loader.api.ModContainer mod, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull com.mojang.datafixers.DataFixer dataFixer)
    Registers a new data fixer.
    static void
    registerMinecraftFixer(@NotNull String modId, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull com.mojang.datafixers.DataFixer dataFixer)
    Registers a new data fixer for use with Minecraft version-specific datafixing.
    static void
    registerMinecraftFixer(@NotNull net.fabricmc.loader.api.ModContainer mod, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull com.mojang.datafixers.DataFixer dataFixer)
    Registers a new data fixer for use with Minecraft version-specific datafixing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BASE_SCHEMA

      public static final BiFunction<Integer,com.mojang.datafixers.schemas.Schema,com.mojang.datafixers.schemas.Schema> BASE_SCHEMA
      A "base" version 0 schema, for use by all mods.

      This schema must be the first one added!

      See Also:
      • DataFixerBuilder.addSchema(int, BiFunction)
  • Constructor Details

    • QuiltDataFixes

      public QuiltDataFixes()
  • Method Details

    • registerFixer

      public static void registerFixer(@NotNull @NotNull String modId, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull @NotNull com.mojang.datafixers.DataFixer dataFixer)
      Registers a new data fixer.
      Parameters:
      modId - the mod identifier
      currentVersion - the current version of the mod's data
      dataFixer - the data fixer
    • registerFixer

      public static void registerFixer(@NotNull @NotNull net.fabricmc.loader.api.ModContainer mod, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull @NotNull com.mojang.datafixers.DataFixer dataFixer)
      Registers a new data fixer.
      Parameters:
      mod - the mod container
      currentVersion - the current version of the mod's data
      dataFixer - the data fixer
    • buildAndRegisterFixer

      public static void buildAndRegisterFixer(@NotNull @NotNull net.fabricmc.loader.api.ModContainer mod, @NotNull @NotNull QuiltDataFixerBuilder dataFixerBuilder)
      Builds and registers a new data fixer.
      Parameters:
      mod - the mod container
      dataFixerBuilder - the data fixer builder
    • registerMinecraftFixer

      public static void registerMinecraftFixer(@NotNull @NotNull String modId, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull @NotNull com.mojang.datafixers.DataFixer dataFixer)
      Registers a new data fixer for use with Minecraft version-specific datafixing.
      Parameters:
      modId - the mod identifier
      currentVersion - the current version of the mod's data
      dataFixer - the data fixer
    • registerMinecraftFixer

      public static void registerMinecraftFixer(@NotNull @NotNull net.fabricmc.loader.api.ModContainer mod, @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int currentVersion, @NotNull @NotNull com.mojang.datafixers.DataFixer dataFixer)
      Registers a new data fixer for use with Minecraft version-specific datafixing.
      Parameters:
      mod - the mod container
      currentVersion - the current version of the mod's data
      dataFixer - the data fixer
    • buildAndRegisterMinecraftFixer

      public static void buildAndRegisterMinecraftFixer(@NotNull @NotNull net.fabricmc.loader.api.ModContainer mod, @NotNull @NotNull QuiltDataFixerBuilder dataFixerBuilder)
      Builds and registers a new data fixer for use with Minecraft version-specific datafixing.
      Parameters:
      mod - the mod container
      dataFixerBuilder - the data fixer builder
    • buildFixer

      public static com.mojang.datafixers.DataFixer buildFixer(@NotNull @NotNull QuiltDataFixerBuilder dataFixerBuilder)
      Builds a new data fixer.
      Parameters:
      dataFixerBuilder - the data fixer builder
      Returns:
      The built data fixer.
    • getFixer

      @NotNull public static @NotNull Optional<com.mojang.datafixers.DataFixer> getFixer(@NotNull @NotNull String modId)
      Gets a mod's Minecraft version-specificdata fixer.
      Parameters:
      modId - the mod identifier
      Returns:
      the mod's data fixer, or empty if the mod hasn't registered one
    • getMinecraftFixer

      @NotNull public static @NotNull Optional<com.mojang.datafixers.DataFixer> getMinecraftFixer(@NotNull @NotNull String modId)
      Gets a mod's Minecraft version-specific data fixer.
      Parameters:
      modId - the mod identifier
      Returns:
      the mod's data fixer, or empty if the mod hasn't registered one
    • getModDataVersion

      @Contract(pure=true) public static @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int getModDataVersion(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound, @NotNull @NotNull String modId)
      Gets a mod's Minecraft version-specific data version from a CompoundTag.
      Parameters:
      compound - the compound
      modId - the mod identifier
      Returns:
      the mod's data version, or 0 if the compound has no data for that mod
    • getModMinecraftDataVersion

      @Contract(pure=true) public static @org.jetbrains.annotations.Range(from=0L, to=2147483647L) int getModMinecraftDataVersion(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound, @NotNull @NotNull String modId)
      Gets a mod's Minecraft version-specific data version from a CompoundTag.
      Parameters:
      compound - the compound
      modId - the mod identifier
      Returns:
      the mod's data version, or 0 if the compound has no data for that mod
    • isFrozen

      @Contract(pure=true) public static boolean isFrozen()
      Checks if the data fixer registry is frozen.
      Returns:
      true if frozen, or false otherwise.