Class QuiltDataFixes
java.lang.Object
org.quiltmc.qsl.frozenblock.misc.datafixerupper.api.QuiltDataFixes
Provides methods to register custom
DataFixers.
Modified to work on Fabric
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BiFunction<Integer, com.mojang.datafixers.schemas.Schema, com.mojang.datafixers.schemas.Schema> A "base" version0schema, for use by all mods. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbuildAndRegisterFixer(@NotNull net.fabricmc.loader.api.ModContainer mod, @NotNull QuiltDataFixerBuilder dataFixerBuilder) Builds and registers a new data fixer.static voidbuildAndRegisterMinecraftFixer(@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.DataFixerbuildFixer(@NotNull QuiltDataFixerBuilder dataFixerBuilder) Builds a new data fixer.static @NotNull Optional<com.mojang.datafixers.DataFixer> 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) intgetModDataVersion(@NotNull net.minecraft.nbt.CompoundTag compound, @NotNull String modId) Gets a mod's Minecraft version-specific data version from aCompoundTag.static @org.jetbrains.annotations.Range(from=0L, to=2147483647L) intgetModMinecraftDataVersion(@NotNull net.minecraft.nbt.CompoundTag compound, @NotNull String modId) Gets a mod's Minecraft version-specific data version from aCompoundTag.static booleanisFrozen()Checks if the data fixer registry is frozen.static voidregisterFixer(@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 voidregisterFixer(@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 voidregisterMinecraftFixer(@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 voidregisterMinecraftFixer(@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.
-
Field Details
-
BASE_SCHEMA
public static final BiFunction<Integer,com.mojang.datafixers.schemas.Schema, BASE_SCHEMAcom.mojang.datafixers.schemas.Schema> A "base" version0schema, for use by all mods.This schema must be the first one added!
- See Also:
-
-
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 identifiercurrentVersion- the current version of the mod's datadataFixer- 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 containercurrentVersion- the current version of the mod's datadataFixer- 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 containerdataFixerBuilder- 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 identifiercurrentVersion- the current version of the mod's datadataFixer- 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 containercurrentVersion- the current version of the mod's datadataFixer- 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 containerdataFixerBuilder- 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 aCompoundTag.- Parameters:
compound- the compoundmodId- the mod identifier- Returns:
- the mod's data version, or
0if 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 aCompoundTag.- Parameters:
compound- the compoundmodId- the mod identifier- Returns:
- the mod's data version, or
0if 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:
trueif frozen, orfalseotherwise.
-