Interface RegistryAccess


@NullMarked @NonExtendable public interface RegistryAccess
Used for accessing different Registry instances by a RegistryKey. Get the main instance of RegistryAccess with registryAccess().
Since:
1.20.6
  • Method Details

    • registryAccess

      static RegistryAccess registryAccess()
      Get the RegistryAccess instance for the server.
      Returns:
      the RegistryAccess instance
      Since:
      1.20.6
    • getRegistry

      @Deprecated(since="1.20.6", forRemoval=true) <T extends Keyed> @Nullable Registry<T> getRegistry(Class<T> type)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets the registry based on the type.
      Type Parameters:
      T - the type
      Parameters:
      type - the type
      Returns:
      the registry or null if none found
    • getRegistry

      <T extends Keyed> Registry<T> getRegistry(RegistryKey<T> registryKey)
      Gets the registry with the specified key.
      Type Parameters:
      T - the type
      Parameters:
      registryKey - the key
      Returns:
      the registry
      Throws:
      NoSuchElementException - if no registry with the key is found
      IllegalArgumentException - if the registry is not available yet
      Since:
      1.20.6