Class EnchantmentThemes

java.lang.Object
johnsmith.enchantingoverhauled.api.enchantment.theme.EnchantmentThemes

public class EnchantmentThemes extends Object
Manages the static ResourceKey references and lookup utilities for the custom, data-driven EnchantmentTheme registry.

Theme definitions are loaded dynamically from JSON files within data/<namespace>/enchantment_theme/.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceKey<EnchantmentTheme>
    The ResourceKey for the fallback common theme, used when an enchantment does not belong to any specialized thematic tag.
    static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<EnchantmentTheme>>
    The ResourceKey used to identify the custom dynamic registry containing all EnchantmentThemes.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static net.minecraft.resources.ResourceKey<EnchantmentTheme>
    getThemeKey(@Nullable net.minecraft.core.RegistryAccess registryAccess, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment)
    Scans the active EnchantmentTheme registry to find which theme tag matches the given enchantment.
    static net.minecraft.tags.TagKey<net.minecraft.world.item.enchantment.Enchantment>
    getThemeTag(net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey)
    Constructs the enchantment TagKey corresponding to a given EnchantmentTheme key (formatted as #<namespace>:theme/<path>).
    static void
    Triggers static class initialization to ensure registry keys are created.
    static boolean
    isCommon(@Nullable net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey)
    Checks whether the given theme key is null or represents the COMMON theme.

    Methods inherited from class java.lang.Object

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

    • THEME_REGISTRY_KEY

      public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<EnchantmentTheme>> THEME_REGISTRY_KEY
      The ResourceKey used to identify the custom dynamic registry containing all EnchantmentThemes.

      Note: The namespace is set to minecraft for compatibility with built-in data systems.

    • COMMON

      public static final net.minecraft.resources.ResourceKey<EnchantmentTheme> COMMON
      The ResourceKey for the fallback common theme, used when an enchantment does not belong to any specialized thematic tag.
  • Constructor Details

    • EnchantmentThemes

      public EnchantmentThemes()
  • Method Details

    • getThemeTag

      public static net.minecraft.tags.TagKey<net.minecraft.world.item.enchantment.Enchantment> getThemeTag(net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey)
      Constructs the enchantment TagKey corresponding to a given EnchantmentTheme key (formatted as #<namespace>:theme/<path>).
      Parameters:
      themeKey - The ResourceKey of the theme.
      Returns:
      The corresponding enchantment TagKey.
    • isCommon

      public static boolean isCommon(@Nullable @Nullable net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey)
      Checks whether the given theme key is null or represents the COMMON theme.
      Parameters:
      themeKey - The ResourceKey to inspect, or null.
      Returns:
      true if the key is null or common; false otherwise.
    • getThemeKey

      public static net.minecraft.resources.ResourceKey<EnchantmentTheme> getThemeKey(@Nullable @Nullable net.minecraft.core.RegistryAccess registryAccess, net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment> enchantment)
      Scans the active EnchantmentTheme registry to find which theme tag matches the given enchantment.
      Parameters:
      registryAccess - The active RegistryAccess, or null.
      enchantment - The enchantment Holder to look up.
      Returns:
      The ResourceKey of the matching theme, or COMMON if none is found.
    • initialize

      public static void initialize()
      Triggers static class initialization to ensure registry keys are created.