Interface EnchantmentLevelLangPatch.WithFallback
- All Superinterfaces:
EnchantmentLevelLangPatch
- Enclosing interface:
EnchantmentLevelLangPatch
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface EnchantmentLevelLangPatch.WithFallback
extends EnchantmentLevelLangPatch
An EnchantmentLevelLangPatch that receives a fallback string.
This should be used when your patch is only applied in Minecraft 1.19.4+, as the patch will be ignored when the fallback string is absent.
Example:
EnchantmentLevelLangPatch.registerPatch(
key -> key.startsWith("example.prefix."),
EnchantmentLevelLangPatch.withFallback((storage, key, fallback) -> Example.hook(key, fallback))
)
-
Nested Class Summary
Nested classes/interfaces inherited from interface EnchantmentLevelLangPatch
EnchantmentLevelLangPatch.WithFallback -
Method Summary
Modifier and TypeMethodDescriptionThe entrypoint forEnchantmentLevelLangPatch.The entrypoint forEnchantmentLevelLangPatch, with fallback string given.
-
Method Details
-
apply
Description copied from interface:EnchantmentLevelLangPatchThe entrypoint forEnchantmentLevelLangPatch.- Specified by:
applyin interfaceEnchantmentLevelLangPatch- Parameters:
translationStorage- an unmodifiable wrapping of the current key-translation mapkey- the provided translation key when thispatchis applied.- Returns:
- the translation (value) you modify. Returning null indicates remaining unchanged.
- See Also:
-
apply
@Nullable String apply(@Unmodifiable Map<String, String> translationStorage, String key, String fallback) Description copied from interface:EnchantmentLevelLangPatchThe entrypoint forEnchantmentLevelLangPatch, with fallback string given.- Specified by:
applyin interfaceEnchantmentLevelLangPatch- Parameters:
translationStorage- an unmodifiable wrapping of the current key-translation mapkey- the provided translation key when thispatchis applied.fallback- the fallback translation provided.- Returns:
- the translation (value) you modify. Returning null indicates remaining unchanged.
- See Also:
-