Class EnchantmentCoreRegistries

java.lang.Object
johnsmith.enchantmentcore.api.registry.EnchantmentCoreRegistries

public class EnchantmentCoreRegistries extends Object
Manages custom static registries required for the modular spell field system.

Initializes registry ResourceKeys, resolves registry suppliers from BuiltInRegistries.REGISTRY, and caches lazily initialized dispatch codecs for polymorphic serialization and deserialization of DistanceScalingFunctions, SpellFieldShapes, and typed SpellFieldEffects.

  • Field Details

    • DISTANCE_SCALING_FUNCTION_KEY

      public static final net.minecraft.resources.ResourceKey<@NotNull net.minecraft.core.Registry<@NotNull com.mojang.serialization.MapCodec<? extends DistanceScalingFunction>>> DISTANCE_SCALING_FUNCTION_KEY
      Registry key for DistanceScalingFunction codec registrations.
    • SPELL_FIELD_SHAPE_KEY

      public static final net.minecraft.resources.ResourceKey<@NotNull net.minecraft.core.Registry<@NotNull com.mojang.serialization.MapCodec<? extends SpellFieldShape>>> SPELL_FIELD_SHAPE_KEY
      Registry key for SpellFieldShape codec registrations.
    • SPELL_FIELD_EFFECT_KEY

      public static final net.minecraft.resources.ResourceKey<@NotNull net.minecraft.core.Registry<@NotNull com.mojang.serialization.MapCodec<? extends SpellFieldEffect>>> SPELL_FIELD_EFFECT_KEY
      Registry key for SpellFieldEffect codec registrations.
    • DISTANCE_SCALING_FUNCTIONS

      public static final Supplier<net.minecraft.core.Registry<@NotNull com.mojang.serialization.MapCodec<? extends DistanceScalingFunction>>> DISTANCE_SCALING_FUNCTIONS
      Supplier resolving the active DistanceScalingFunction registry from BuiltInRegistries.REGISTRY.
    • SPELL_FIELD_SHAPES

      public static final Supplier<net.minecraft.core.Registry<@NotNull com.mojang.serialization.MapCodec<? extends SpellFieldShape>>> SPELL_FIELD_SHAPES
      Supplier resolving the active SpellFieldShape registry from BuiltInRegistries.REGISTRY.
    • SPELL_FIELD_EFFECTS

      public static final Supplier<net.minecraft.core.Registry<@NotNull com.mojang.serialization.MapCodec<? extends SpellFieldEffect>>> SPELL_FIELD_EFFECTS
      Supplier resolving the active SpellFieldEffect registry from BuiltInRegistries.REGISTRY.
  • Constructor Details

    • EnchantmentCoreRegistries

      public EnchantmentCoreRegistries()
  • Method Details

    • getDistanceScalingFunctionCodec

      public static com.mojang.serialization.Codec<DistanceScalingFunction> getDistanceScalingFunctionCodec()
      Retrieves the polymorphic dispatch codec for DistanceScalingFunction instances.

      Uses Codec.lazyInitialized(java.util.function.Supplier<com.mojang.serialization.Codec<A>>) so custom registries are not queried before loader registry events populate BuiltInRegistries.REGISTRY.

      Returns:
      The cached DistanceScalingFunction dispatch codec.
    • getSpellFieldShapeCodec

      public static com.mojang.serialization.Codec<SpellFieldShape> getSpellFieldShapeCodec()
      Retrieves the polymorphic dispatch codec for SpellFieldShape instances.

      Uses Codec.lazyInitialized(java.util.function.Supplier<com.mojang.serialization.Codec<A>>) so custom registries are not queried before loader registry events populate BuiltInRegistries.REGISTRY.

      Returns:
      The cached SpellFieldShape dispatch codec.
    • getSpellFieldEntityEffectCodec

      public static com.mojang.serialization.Codec<SpellFieldEntityEffect> getSpellFieldEntityEffectCodec()
      Retrieves a strictly typed dispatch codec for entity-targeted spell field effects. Rejects effects that do not implement the SpellFieldEntityEffect contract.
      Returns:
      The type-filtered SpellFieldEntityEffect codec.
    • getSpellFieldBlockEffectCodec

      public static com.mojang.serialization.Codec<SpellFieldBlockEffect> getSpellFieldBlockEffectCodec()
      Retrieves a strictly typed dispatch codec for block-targeted spell field effects. Rejects effects that do not implement the SpellFieldBlockEffect contract.
      Returns:
      The type-filtered SpellFieldBlockEffect codec.
    • getSpellFieldVolumeEffectCodec

      public static com.mojang.serialization.Codec<SpellFieldVolumeEffect> getSpellFieldVolumeEffectCodec()
      Retrieves a strictly typed dispatch codec for volume-targeted spell field effects. Rejects effects that do not implement the SpellFieldVolumeEffect contract.
      Returns:
      The type-filtered SpellFieldVolumeEffect codec.
    • getSpellFieldVisualEffectCodec

      public static com.mojang.serialization.Codec<SpellFieldVisualEffect> getSpellFieldVisualEffectCodec()
      Retrieves a strictly typed dispatch codec for visual/particle spell field effects. Rejects effects that do not implement the SpellFieldVisualEffect contract.
      Returns:
      The type-filtered SpellFieldVisualEffect codec.
    • initialize

      public static void initialize()
      Initializes the custom registry keys and suppliers.