Class EnchantmentThemes
java.lang.Object
johnsmith.enchantingoverhauled.api.enchantment.theme.EnchantmentThemes
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
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.resources.ResourceKey<EnchantmentTheme> TheResourceKeyfor 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>> TheResourceKeyused to identify the custom dynamic registry containing allEnchantmentThemes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 activeEnchantmentThemeregistry 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 enchantmentTagKeycorresponding to a givenEnchantmentThemekey (formatted as#<namespace>:theme/<path>).static voidTriggers static class initialization to ensure registry keys are created.static booleanisCommon(@Nullable net.minecraft.resources.ResourceKey<EnchantmentTheme> themeKey) Checks whether the given theme key isnullor represents theCOMMONtheme.
-
Field Details
-
THEME_REGISTRY_KEY
public static final net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<EnchantmentTheme>> THEME_REGISTRY_KEYTheResourceKeyused to identify the custom dynamic registry containing allEnchantmentThemes.Note: The namespace is set to
minecraftfor compatibility with built-in data systems. -
COMMON
TheResourceKeyfor 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 enchantmentTagKeycorresponding to a givenEnchantmentThemekey (formatted as#<namespace>:theme/<path>).- Parameters:
themeKey- TheResourceKeyof 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 isnullor represents theCOMMONtheme.- Parameters:
themeKey- TheResourceKeyto inspect, ornull.- Returns:
trueif the key isnullorcommon;falseotherwise.
-
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 activeEnchantmentThemeregistry to find which theme tag matches the given enchantment.- Parameters:
registryAccess- The activeRegistryAccess, ornull.enchantment- The enchantmentHolderto look up.- Returns:
- The
ResourceKeyof the matching theme, orCOMMONif none is found.
-
initialize
public static void initialize()Triggers static class initialization to ensure registry keys are created.
-