Interface FabricTagKey


public interface FabricTagKey
General-purpose Fabric-provided extensions for TagKey subclasses.

These extensions were designed primarily for giving extra utility methods for TagKeys usages. Getting a TagKey's translation key for example.

Note: This interface is automatically implemented on all TagKey instances via Mixin and interface injection.

  • Method Summary

    Modifier and Type
    Method
    Description
    default Text
    Use this to get a TagKey's translatable text for display purposes.
    default String
    Use this to get a TagKey's translation key safely on any side.
  • Method Details

    • getTranslationKey

      default String getTranslationKey()
      Use this to get a TagKey's translation key safely on any side.

      Format for vanilla registry TagKeys is: tag.(registry_path).(tag_namespace).(tag_path)

      Format for modded registry TagKeys is: tag.(registry_namespace).(registry_path).(tag_namespace).(tag_path)

      The registry's path and tag path's slashes will be converted to periods.

      Returns:
      the translation key for a TagKey
    • getName

      default Text getName()
      Use this to get a TagKey's translatable text for display purposes.

      The text uses the result of

      invalid reference
      TagKey#getTranslationKey
      for the translation key and will fall back to displaying #tag_namespace:tag_path if no translation exists.
      Returns:
      the translatable text for a TagKey