-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Value Integration
If you need to introduce entirely new mathematical formulas or specialized configuration-aware logic (e.g., retrieving a value from a completely different mod's API), you can register custom LevelBasedValue codecs.
Because LevelBasedValue is a native Vanilla Minecraft concept, you register your custom implementations directly into BuiltInRegistries.ENCHANTMENT_LEVEL_BASED_VALUE_TYPE.
Assume you have written a custom SineWaveValue record that implements LevelBasedValue.
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
public class MyModValueRegistry {
public static void initialize() {
Registry.register(
BuiltInRegistries.ENCHANTMENT_LEVEL_BASED_VALUE_TYPE,
ResourceLocation.fromNamespaceAndPath("my_mod", "sine_wave"),
SineWaveValue.CODEC
);
}
}If your custom LevelBasedValue represents a static mathematical curve, and you want to allow players to configure its parameters dynamically via Config Overhauled, you must also pair it with a configurable equivalent codec.
Refer to the guides for the Value Importer Registry and Value Exporter Registry to learn how to create dynamic equivalents that support the in-game datapack /enchantment_core transformation commands.
Want to learn more about the configuration engine powering Enchantment Core?
Check out Config Understood, the official wiki for Config Overhauled, for a deep dive into dynamic property generation and state synchronization!