Interface ResourceFactory

All Known Subinterfaces:
LifecycledResourceManager, ResourceManager
All Known Implementing Classes:
LifecycledResourceManagerImpl, NamespaceResourceManager, ReloadableResourceManagerImpl, ResourceManager.Empty
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ResourceFactory
Provides resource access.
Mappings:
Namespace Name
official ahb
intermediary net/minecraft/class_5912
named net/minecraft/resource/ResourceFactory
  • Method Details

    • getResource

      Optional<Resource> getResource(Identifier id)
      Finds and returns the corresponding resource for a resource's identifier.

      Starts by scanning each resource pack from highest priority to lowest. If no resource packs were found to contain the requested entry, will throw a FileNotFoundException.

      The returned resource must be closed to avoid resource leaks.

      Parameters:
      id - the resource identifier to search for
      Throws:
      FileNotFoundException - if the identified resource could not be found, or could not be loaded.
      IOException - if the identified resource was found but a stream to it could not be opened.
      Mappings:
      Namespace Name Mixin selector
      official getResource Lahb;getResource(Lzo;)Ljava/util/Optional;
      intermediary method_14486 Lnet/minecraft/class_5912;method_14486(Lnet/minecraft/class_2960;)Ljava/util/Optional;
      named getResource Lnet/minecraft/resource/ResourceFactory;getResource(Lnet/minecraft/util/Identifier;)Ljava/util/Optional;
    • getResourceOrThrow

      default Resource getResourceOrThrow(Identifier identifier) throws FileNotFoundException
      Throws:
      FileNotFoundException
    • open

      default InputStream open(Identifier identifier) throws IOException
      Throws:
      IOException
    • openAsReader

      default BufferedReader openAsReader(Identifier identifier) throws IOException
      Throws:
      IOException