Interface Registry<T>

All Superinterfaces:
net.kyori.adventure.key.Keyed
All Known Subinterfaces:
DynamicRegistry<T>

public sealed interface Registry<T> extends net.kyori.adventure.key.Keyed permits DynamicRegistry<T> (not exhaustive)
  • Method Details

    • get

      @Nullable T get(int id)
    • get

      @Nullable T get(@NotNull @NotNull net.kyori.adventure.key.Key key)
    • get

      @Nullable default T get(@NotNull @NotNull RegistryKey<T> key)
    • getKey

      @Nullable @Nullable RegistryKey<T> getKey(int id)
    • getKey

      @Nullable @Nullable RegistryKey<T> getKey(@NotNull T value)
    • getKey

      @Nullable @Nullable RegistryKey<T> getKey(@NotNull @NotNull net.kyori.adventure.key.Key key)
    • getId

      int getId(@NotNull @NotNull RegistryKey<T> key)
      Returns the protocol ID associated with the given RegistryKey, or -1 if none is registered.
    • getPack

      @Nullable @Nullable DataPack getPack(int id)
    • getPack

      @Nullable default @Nullable DataPack getPack(@NotNull @NotNull RegistryKey<T> key)
    • size

      int size()
      Returns the number of entries present in this registry.
    • keys

      @NotNull @NotNull Collection<RegistryKey<T>> keys()

      Returns the keys in this registry as an immutable list.

      Note: The list order is not guaranteed, and the contents are not guaranteed to update with the registry, it should be fetched again for updated values.

      Returns:
      An immutable collection of the keys in this registry.
    • values

      @NotNull @NotNull Collection<T> values()

      Returns the entries in this registry as an immutable list.

      Note: The list order is not guaranteed, and the contents are not guaranteed to update with the registry, it should be fetched again for updated values.

      Returns:
      An immutable list of the entries in this registry.
    • getTag

      @Nullable @Nullable RegistryTag<T> getTag(@NotNull @NotNull TagKey<T> key)
      Get a tag by its key.
      Parameters:
      key - The key of the tag
      Returns:
      The tag, or null if not found
    • getTag

      @Nullable default @Nullable RegistryTag<T> getTag(@NotNull @NotNull net.kyori.adventure.key.Key key)
    • getOrCreateTag

      @NotNull @NotNull RegistryTag<T> getOrCreateTag(@NotNull @NotNull TagKey<T> key)
      Get a tag by its key, or create it if it does not exist.

      Note that if a tag is created by this operation, it will not be added to clients who previously received tags. You must resend updated registry tags manually for this to take effect. Referencing a tag for which the client is not aware will result in an immediate clientside disconnect.

      Parameters:
      key - The key of the tag
      Returns:
      The tag, never null
    • removeTag

      boolean removeTag(@NotNull @NotNull TagKey<T> key)
      Removes the given tag from this registry if it exists.

      Note that this does _not_ remove the tag from clients who have previously received tags. You must resend updated registry tags manually for this to take effect.

      Parameters:
      key - The registry tag to remove.
      Returns:
      True if the tag was removed, false if it did not exist in this registry.
    • tags

      @NotNull @NotNull Collection<RegistryTag<T>> tags()

      Returns the available tags in this registry.

      Note: The returned list is not guaranteed to update with the registry, it should be fetched again for updated values.

      Returns:
      An immutable collection of the tags in this registry.
    • tagRegistry

      @Internal @NotNull TagsPacket.Registry tagRegistry()