Some more resource docs and a few constant fields (#2242)

* Some more resource docs and a few constant fields

Signed-off-by: liach <liach@users.noreply.github.com>

* Apply suggestions from code review

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

Co-authored-by: liach <liach@users.noreply.github.com>
Co-authored-by: YanisBft <doublecraft.official@gmail.com>
This commit is contained in:
liach 2021-04-03 04:05:30 +07:00 committed by GitHub
parent 355c529aa1
commit 49ac5cbb8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 77 additions and 2 deletions

View File

@ -5,6 +5,7 @@ CLASS net/minecraft/class_4309 net/minecraft/resource/JsonDataLoader
FIELD field_19378 FILE_SUFFIX_LENGTH I
FIELD field_19379 gson Lcom/google/gson/Gson;
FIELD field_19380 dataType Ljava/lang/String;
FIELD field_29783 FILE_SUFFIX Ljava/lang/String;
METHOD <init> (Lcom/google/gson/Gson;Ljava/lang/String;)V
ARG 1 gson
ARG 2 dataType

View File

@ -1,7 +1,26 @@
CLASS net/minecraft/class_3298 net/minecraft/resource/Resource
COMMENT A resource of binary data.
COMMENT
COMMENT <p>The resource must be closed before disposal to avoid resource leaks.
COMMENT
COMMENT @see ResourceFactory#getResource(Identifier)
COMMENT @see ResourceManager#getAllResources(Identifier)
METHOD method_14480 getResourcePackName ()Ljava/lang/String;
COMMENT Returns the user-friendly name of the pack this resource is from.
METHOD method_14481 getMetadata (Lnet/minecraft/class_3270;)Ljava/lang/Object;
COMMENT Returns a metadata of this resource by the {@code metaReader}, or {@code null}
COMMENT if no such metadata exists.
ARG 1 metaReader
COMMENT the metadata reader
METHOD method_14482 getInputStream ()Ljava/io/InputStream;
COMMENT Returns the input stream of this resource.
COMMENT
COMMENT <p>This input stream is closed when this resource is closed.
METHOD method_14483 getId ()Lnet/minecraft/class_2960;
COMMENT Returns the location of this resource.
COMMENT
COMMENT <p>Within each resource pack, this location is a unique identifer for a
COMMENT resource; however, in a resource manager, there may be multiple resources
COMMENT with the same location available.
METHOD method_14484 hasMetadata ()Z
COMMENT Returns if this resource has any metadata.

View File

@ -6,6 +6,8 @@ CLASS net/minecraft/class_5912 net/minecraft/resource/ResourceFactory
COMMENT <p>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
COMMENT <p>The returned resource must be closed to avoid resource leaks.
COMMENT
COMMENT @throws java.io.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

View File

@ -22,6 +22,8 @@ CLASS net/minecraft/class_3300 net/minecraft/resource/ResourceManager
COMMENT <p>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
COMMENT <p>Each resource in this returned list must be closed to avoid resource leaks.
COMMENT
COMMENT @throws java.io.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

View File

@ -1,4 +1,10 @@
CLASS net/minecraft/class_3262 net/minecraft/resource/ResourcePack
COMMENT A resource pack, providing resources to resource managers.
COMMENT
COMMENT <p>They are single-use in each reload cycle of a reloadable resource manager.
COMMENT {@link ResourcePackProfile} is a persistent version of the resource packs.
FIELD field_29780 METADATA_PATH_SUFFIX Ljava/lang/String;
FIELD field_29781 PACK_METADATA_NAME Ljava/lang/String;
METHOD method_14405 open (Lnet/minecraft/class_3264;Lnet/minecraft/class_2960;)Ljava/io/InputStream;
ARG 1 type
ARG 2 id

View File

@ -1,4 +1,7 @@
CLASS net/minecraft/class_3283 net/minecraft/resource/ResourcePackManager
COMMENT A resource pack manager manages a list of {@link ResourcePackProfile}s and
COMMENT builds {@linkplain #createResourcePacks() a list of resource packs} when the
COMMENT resource manager reloads.
FIELD field_14225 enabled Ljava/util/List;
FIELD field_14226 profiles Ljava/util/Map;
FIELD field_14227 providers Ljava/util/Set;

View File

@ -1,8 +1,17 @@
CLASS net/minecraft/class_3288 net/minecraft/resource/ResourcePackProfile
COMMENT Represents a resource pack in a {@link ResourcePackManager}.
COMMENT
COMMENT <p>Compared to a single-use {@link ResourcePack}, a profile is persistent
COMMENT and serves as {@linkplain #createResourcePack a factory} for the single-use
COMMENT packs. It also contains user-friendly information about resource packs.
COMMENT
COMMENT <p>The profiles are registered by {@link ResourcePackProvider}s.
COMMENT
COMMENT <p>Closing the profile doesn't have any effect.
FIELD field_14270 pinned Z
FIELD field_14271 alwaysEnabled Z
FIELD field_14272 name Ljava/lang/String;
FIELD field_14273 packGetter Ljava/util/function/Supplier;
FIELD field_14273 packFactory Ljava/util/function/Supplier;
FIELD field_14274 displayName Lnet/minecraft/class_2561;
FIELD field_14275 description Lnet/minecraft/class_2561;
FIELD field_14277 position Lnet/minecraft/class_3288$class_3289;
@ -31,10 +40,18 @@ CLASS net/minecraft/class_3288 net/minecraft/resource/ResourcePackProfile
METHOD equals (Ljava/lang/Object;)Z
ARG 1 o
METHOD method_14456 of (Ljava/lang/String;ZLjava/util/function/Supplier;Lnet/minecraft/class_3288$class_5351;Lnet/minecraft/class_3288$class_3289;Lnet/minecraft/class_5352;)Lnet/minecraft/class_3288;
COMMENT Creates a resource pack profile from the given parameters.
COMMENT
COMMENT <p>Compared to calling the factory directly, this utility method obtains the
COMMENT pack's metadata information from the pack created by the {@code packFactory}.
COMMENT If the created pack doesn't have metadata information, this method returns
COMMENT {@code null}.
COMMENT
COMMENT @return the created profile, or {@code null} if missing metadata
ARG 0 name
ARG 1 alwaysEnabled
ARG 2 packFactory
ARG 3 containerFactory
ARG 3 profileFactory
ARG 4 insertionPosition
ARG 5 packSource
METHOD method_14457 getDisplayName ()Lnet/minecraft/class_2561;
@ -56,7 +73,14 @@ CLASS net/minecraft/class_3288 net/minecraft/resource/ResourcePackProfile
ARG 3 profileGetter
ARG 4 listInverted
CLASS class_5351 Factory
COMMENT A factory for resource pack profiles, somewhat resembling the constructor
COMMENT of {@link ResourcePackProfile} but allowing more customization.
METHOD create (Ljava/lang/String;Lnet/minecraft/class_2561;ZLjava/util/function/Supplier;Lnet/minecraft/class_3272;Lnet/minecraft/class_3288$class_3289;Lnet/minecraft/class_5352;)Lnet/minecraft/class_3288;
COMMENT Creates a proper resource pack profile from the given parameters.
COMMENT
COMMENT @apiNote Instead of calling this method, users usually call {@link
COMMENT ResourcePackProfile#of}, which fills some of the parameters for a call to this
COMMENT method.
ARG 1 name
ARG 2 displayName
ARG 3 alwaysEnabled

View File

@ -1,3 +1,12 @@
CLASS net/minecraft/class_3285 net/minecraft/resource/ResourcePackProvider
COMMENT A resource pack provider provides {@link ResourcePackProfile}s, usually to
COMMENT {@link ResourcePackManager}s.
METHOD method_14453 register (Ljava/util/function/Consumer;Lnet/minecraft/class_3288$class_5351;)V
COMMENT Register resource pack profiles created with the {@code factory} to the
COMMENT {@code profileAdder}.
COMMENT
COMMENT @see ResourcePackProfile#of
ARG 1 profileAdder
COMMENT the profile adder that accepts created resource pack profiles
ARG 2 factory
COMMENT the factory that creates the resource pack profiles

View File

@ -11,6 +11,14 @@ CLASS net/minecraft/class_4014 net/minecraft/resource/SimpleResourceReload
FIELD field_18047 appliedCount I
FIELD field_18048 toPrepareCount Ljava/util/concurrent/atomic/AtomicInteger;
FIELD field_18049 preparedCount Ljava/util/concurrent/atomic/AtomicInteger;
FIELD field_29784 FIRST_PREPARE_APPLY_WEIGHT I
COMMENT The weight of either prepare or apply stages' progress in the total progress
COMMENT calculation. Has value {@value}.
FIELD field_29785 SECOND_PREPARE_APPLY_WEIGHT I
COMMENT The weight of either prepare or apply stages' progress in the total progress
COMMENT calculation. Has value {@value}.
FIELD field_29786 RELOADER_WEIGHT I
COMMENT The weight of reloaders' progress in the total progress calculation. Has value {@value}.
METHOD <init> (Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Lnet/minecraft/class_3300;Ljava/util/List;Lnet/minecraft/class_4014$class_4047;Ljava/util/concurrent/CompletableFuture;)V
ARG 1 prepareExecutor
ARG 2 applyExecutor

View File

@ -1,3 +1,4 @@
CLASS net/minecraft/class_3286 net/minecraft/resource/VanillaDataPackProvider
FIELD field_14269 pack Lnet/minecraft/class_3268;
FIELD field_26939 DEFAULT_PACK_METADATA Lnet/minecraft/class_3272;
FIELD field_29782 NAME Ljava/lang/String;