Interface JavaRegistryLookup<T>

Type Parameters:
T - the type of the registry
All Known Subinterfaces:
JavaRegistry<T>, MutableJavaRegistry<T>
All Known Implementing Classes:
SimpleJavaRegistry

public interface JavaRegistryLookup<T>
Provides basic access to a Java registry as defined in JavaRegistries. Instances of this interface should be used to get access to one or multiple entries in the registry. For iterating over the entire registry, see the extensions provided by JavaRegistry.

Instances of this interface can be obtained through JavaRegistryProvider (usually provided by GeyserSession.javaRegistries()), or by using the constants in BuiltInJavaRegistries.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default Optional<T>
    get(int networkId)
    Gets the JavaRegistryLookup for the given networkId in this registry, or returns an empty optional if it didn't exist.
    default Optional<T>
    get(net.kyori.adventure.key.Key key)
    Gets the JavaRegistryLookup for the given key in this registry, or returns an empty optional if it didn't exist.
    getById(int networkId)
    Gets the RegistryEntryData for the given networkId in this registry, or returns an empty optional if it didn't exist.
    getByKey(net.kyori.adventure.key.Key key)
    Gets the RegistryEntryData for the given key in this registry, or returns an empty optional if it didn't exist.
    getByValue(T object)
    Gets the RegistryEntryData for the given object in this registry, or returns an empty optional if it didn't exist.
    default OptionalInt
    getId(net.kyori.adventure.key.Key key)
    Gets the network ID for the given key in this registry, or returns an empty optional if it didn't exist.
    default OptionalInt
    getId(T object)
    Gets the network ID for the given object in this registry, or returns an empty optional if it didn't exist.
    default int
    getIdOrThrow(net.kyori.adventure.key.Key key)
    Gets the network ID for the given key in this registry, or throws if it didn't exist.
    default int
    getIdOrThrow(T object)
    Gets the network ID for the given object in this registry, or throws if it didn't exist.
    default Optional<net.kyori.adventure.key.Key>
    getKey(int networkId)
    Gets the Key for the given networkId in this registry, or returns an empty optional if it didn't exist.
    default Optional<net.kyori.adventure.key.Key>
    getKey(T object)
    Gets the Key for the given object in this registry, or returns an empty optional if it didn't exist.
    default net.kyori.adventure.key.Key
    getKeyOrThrow(int networkId)
    Gets the Key for the given networkId in this registry, or throws if it didn't exist.
    default net.kyori.adventure.key.Key
    getKeyOrThrow(T object)
    Gets the Key for the given object in this registry, or throws if it didn't exist.
    default T
    getOrThrow(int networkId)
    Gets the JavaRegistryLookup for the given networkId in this registry, or throws if it didn't exist.
    default T
    getOrThrow(net.kyori.adventure.key.Key key)
    Gets the JavaRegistryLookup for the given key in this registry, or throws if it didn't exist.
  • Method Details

    • getIdOrThrow

      default int getIdOrThrow(T object)
      Gets the network ID for the given object in this registry, or throws if it didn't exist.
      Parameters:
      object - the object to look up
      Returns:
      the network ID correlating to the object
      Throws:
      IllegalStateException - when the object was not present in this registry
    • getId

      default OptionalInt getId(T object)
      Gets the network ID for the given object in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      object - the object to look up
      Returns:
      the network ID correlating to the object, or an empty optional if it didn't exist
    • getIdOrThrow

      default int getIdOrThrow(net.kyori.adventure.key.Key key)
      Gets the network ID for the given key in this registry, or throws if it didn't exist.
      Parameters:
      key - the key to look up
      Returns:
      the network ID correlating to the key
      Throws:
      IllegalStateException - when the key was not present in this registry
    • getId

      default OptionalInt getId(net.kyori.adventure.key.Key key)
      Gets the network ID for the given key in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      key - the key to look up
      Returns:
      the network ID correlating to the key, or an empty optional if it didn't exist
    • getKeyOrThrow

      default net.kyori.adventure.key.Key getKeyOrThrow(T object)
      Gets the Key for the given object in this registry, or throws if it didn't exist.
      Parameters:
      object - the object to look up
      Returns:
      the Key correlating to the object
      Throws:
      IllegalStateException - when the object was not present in this registry
    • getKey

      default Optional<net.kyori.adventure.key.Key> getKey(T object)
      Gets the Key for the given object in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      object - the object to look up
      Returns:
      the Key correlating to the object, or an empty optional if it didn't exist
    • getKeyOrThrow

      default net.kyori.adventure.key.Key getKeyOrThrow(int networkId)
      Gets the Key for the given networkId in this registry, or throws if it didn't exist.
      Parameters:
      networkId - the network ID to look up
      Returns:
      the Key correlating to the network ID
      Throws:
      IllegalStateException - when the networkId was not present in this registry
    • getKey

      default Optional<net.kyori.adventure.key.Key> getKey(int networkId)
      Gets the Key for the given networkId in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      networkId - the network ID to look up
      Returns:
      the Key correlating to the network ID, or an empty optional if it didn't exist
    • getOrThrow

      default T getOrThrow(int networkId)
      Gets the JavaRegistryLookup for the given networkId in this registry, or throws if it didn't exist.
      Parameters:
      networkId - the network ID to look up
      Returns:
      the JavaRegistryLookup correlating to the network ID
      Throws:
      IllegalStateException - when the networkId was not present in this registry
    • get

      default Optional<T> get(int networkId)
      Gets the JavaRegistryLookup for the given networkId in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      networkId - the network ID to look up
      Returns:
      the JavaRegistryLookup correlating to the network ID, or an empty optional if it didn't exist
    • getOrThrow

      default T getOrThrow(net.kyori.adventure.key.Key key)
      Gets the JavaRegistryLookup for the given key in this registry, or throws if it didn't exist.
      Parameters:
      key - the key to look up
      Returns:
      the JavaRegistryLookup correlating to the key
      Throws:
      IllegalStateException - when the key was not present in this registry
    • get

      default Optional<T> get(net.kyori.adventure.key.Key key)
      Gets the JavaRegistryLookup for the given key in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      key - the key to look up
      Returns:
      the JavaRegistryLookup correlating to the key, or an empty optional if it didn't exist
    • getById

      Optional<RegistryEntryData<T>> getById(int networkId)
      Gets the RegistryEntryData for the given networkId in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      networkId - the network ID to look up
      Returns:
      the RegistryEntryData correlating to the network ID, or an empty optional if it didn't exist
    • getByKey

      Optional<RegistryEntryData<T>> getByKey(net.kyori.adventure.key.Key key)
      Gets the RegistryEntryData for the given key in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      key - the key to look up
      Returns:
      the RegistryEntryData correlating to the key, or an empty optional if it didn't exist
    • getByValue

      Optional<RegistryEntryData<T>> getByValue(T object)
      Gets the RegistryEntryData for the given object in this registry, or returns an empty optional if it didn't exist.
      Parameters:
      object - the object to look up
      Returns:
      the RegistryEntryData correlating to the object, or an empty optional if it didn't exist