ResourceManager documentation (#1898)

* add documentation for the ResourceManager

* Apply suggestions from code review

Co-authored-by: YanisBft <doublecraft.official@gmail.com>

Co-authored-by: YanisBft <doublecraft.official@gmail.com>
This commit is contained in:
­Sollace 2020-12-02 16:37:53 +02:00 committed by GitHub
parent 768f78c0ac
commit 1766e41fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 36 additions and 1 deletions

View File

@ -1,13 +1,48 @@
CLASS net/minecraft/class_3300 net/minecraft/resource/ResourceManager
COMMENT Provides resource loading capabilities to Minecraft.
METHOD method_14486 getResource (Lnet/minecraft/class_2960;)Lnet/minecraft/class_3298;
COMMENT Finds and returns the corresponding resource for a resource's identifier.
COMMENT <br>
COMMENT Starts by scanning each resource pack from highest priority to lowest. If no resource packs were found
COMMENT to contain the requested entry, will throw a {@code FileNotFoundException}.
COMMENT <br>
COMMENT @throws FileNotFoundException if the identified resource could not be found, or could not be loaded.
COMMENT @throws IOException if the identified resource was found but a stream to it could not be opened.
ARG 1 id
COMMENT the resource identifier to search for
METHOD method_14487 getAllNamespaces ()Ljava/util/Set;
COMMENT Gets a set of all namespaces offered by the resource packs loaded by this manager.
METHOD method_14488 findResources (Ljava/lang/String;Ljava/util/function/Predicate;)Ljava/util/Collection;
ARG 1 resourceType
COMMENT Returns a sorted list of identifiers matching a path predicate.
COMMENT <br>
COMMENT Scanning begins in {@code startingPath} and each candidate file present under that directory
COMMENT will be offered up to the predicate to decide whether it should be included or not.
COMMENT <br>
COMMENT Elements in the returned list may not, necessarily be unique. Additional effort is advised to ensure that
COMMENT duplicates in the returned list are discarded before loading.
COMMENT
COMMENT @return the list matching identifiers
ARG 1 startingPath
COMMENT the starting path to begin scanning from
ARG 2 pathPredicate
COMMENT a predicate to determine whether a path should be included or not
METHOD method_14489 getAllResources (Lnet/minecraft/class_2960;)Ljava/util/List;
COMMENT Gets all of the available resources to the corresponding resource identifier.
COMMENT <br>
COMMENT Resources are returned in load order, or ascending order of priority, so the last element in the returned
COMMENT list is what would be returned normally by {@link #getResource}
COMMENT <br>
COMMENT @throws FileNotFoundException if no matching resources could be found (i.e. if the list would be empty)
COMMENT @throws IOException if resources were found, but any one of them could not be opened to be read.
ARG 1 id
COMMENT the resource identifier to search for
METHOD method_18234 containsResource (Lnet/minecraft/class_2960;)Z
COMMENT Checks whether any of the currently-loaded resource packs contain an entry for the given id.
COMMENT <br>
COMMENT Starts by querying the resource pack with the highest priority to lowest until it finds one that
COMMENT responds to the requested identifier.
ARG 1 id
COMMENT the resource identifier to search for
METHOD method_29213 streamResourcePacks ()Ljava/util/stream/Stream;
COMMENT Gets a stream of loaded resource packs in increasing order of priority.
CLASS class_5353 Empty