Interface TypedKey<T>

Type Parameters:
T - the value type for the registry
All Superinterfaces:
Comparable<net.kyori.adventure.key.Key>, net.kyori.examination.Examinable, net.kyori.adventure.key.Key, net.kyori.adventure.key.Keyed, net.kyori.adventure.key.Namespaced

@NullMarked public sealed interface TypedKey<T> extends net.kyori.adventure.key.Key
Represents a key for a value in a specific registry.
  • Field Summary

    Fields inherited from interface net.kyori.adventure.key.Key

    DEFAULT_SEPARATOR, MINECRAFT_NAMESPACE
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> TypedKey<T>
    create(RegistryKey<T> registryKey, String key)
    Create a typed key from a string and a registry key.
    static <T> TypedKey<T>
    create(RegistryKey<T> registryKey, net.kyori.adventure.key.Key key)
    Create a typed key from a key and a registry key.
    net.kyori.adventure.key.Key
    key()
    Gets the key for the value in the registry.
    Gets the registry key for the value this key represents.

    Methods inherited from interface net.kyori.examination.Examinable

    examinableName, examine

    Methods inherited from interface net.kyori.adventure.key.Key

    asMinimalString, asString, compareTo, examinableProperties, namespace, value
  • Method Details

    • key

      net.kyori.adventure.key.Key key()
      Gets the key for the value in the registry.
      Specified by:
      key in interface net.kyori.adventure.key.Key
      Specified by:
      key in interface net.kyori.adventure.key.Keyed
      Returns:
      the value's key
    • registryKey

      RegistryKey<T> registryKey()
      Gets the registry key for the value this key represents.
      Returns:
      the registry key
    • create

      static <T> TypedKey<T> create(RegistryKey<T> registryKey, net.kyori.adventure.key.Key key)
      Create a typed key from a key and a registry key.
      Type Parameters:
      T - value type
      Parameters:
      registryKey - the registry this key is for
      key - the key for the value in the registry
      Returns:
      a new key for the value key and registry key
    • create

      static <T> TypedKey<T> create(RegistryKey<T> registryKey, @KeyPattern String key)
      Create a typed key from a string and a registry key.
      Type Parameters:
      T - value type
      Parameters:
      registryKey - the registry this key is for
      key - the string version of a Key that will be passed to Key.key(String) for parsing.
      Returns:
      a new key for the value key and registry key
      See Also:
      • Key.key(String)