From 49ac5cbb8cd03d1861615255b4591d25bf2d92d3 Mon Sep 17 00:00:00 2001 From: liach <7806504+liach@users.noreply.github.com> Date: Sat, 3 Apr 2021 04:05:30 +0700 Subject: [PATCH] Some more resource docs and a few constant fields (#2242) * Some more resource docs and a few constant fields Signed-off-by: liach * Apply suggestions from code review Co-authored-by: YanisBft Co-authored-by: liach Co-authored-by: YanisBft --- .../minecraft/resource/JsonDataLoader.mapping | 1 + .../net/minecraft/resource/Resource.mapping | 19 +++++++++++++ .../resource/ResourceFactory.mapping | 2 ++ .../resource/ResourceManager.mapping | 2 ++ .../minecraft/resource/ResourcePack.mapping | 6 ++++ .../resource/ResourcePackManager.mapping | 3 ++ .../resource/ResourcePackProfile.mapping | 28 +++++++++++++++++-- .../resource/ResourcePackProvider.mapping | 9 ++++++ .../resource/SimpleResourceReload.mapping | 8 ++++++ .../resource/VanillaDataPackProvider.mapping | 1 + 10 files changed, 77 insertions(+), 2 deletions(-) diff --git a/mappings/net/minecraft/resource/JsonDataLoader.mapping b/mappings/net/minecraft/resource/JsonDataLoader.mapping index e272ecaee6..d0f9360ca5 100644 --- a/mappings/net/minecraft/resource/JsonDataLoader.mapping +++ b/mappings/net/minecraft/resource/JsonDataLoader.mapping @@ -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 (Lcom/google/gson/Gson;Ljava/lang/String;)V ARG 1 gson ARG 2 dataType diff --git a/mappings/net/minecraft/resource/Resource.mapping b/mappings/net/minecraft/resource/Resource.mapping index 0cc4016731..e3be3638d3 100644 --- a/mappings/net/minecraft/resource/Resource.mapping +++ b/mappings/net/minecraft/resource/Resource.mapping @@ -1,7 +1,26 @@ CLASS net/minecraft/class_3298 net/minecraft/resource/Resource + COMMENT A resource of binary data. + COMMENT + COMMENT

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

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

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. diff --git a/mappings/net/minecraft/resource/ResourceFactory.mapping b/mappings/net/minecraft/resource/ResourceFactory.mapping index 20b55e831c..7954a3f678 100644 --- a/mappings/net/minecraft/resource/ResourceFactory.mapping +++ b/mappings/net/minecraft/resource/ResourceFactory.mapping @@ -6,6 +6,8 @@ CLASS net/minecraft/class_5912 net/minecraft/resource/ResourceFactory 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 + COMMENT

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 diff --git a/mappings/net/minecraft/resource/ResourceManager.mapping b/mappings/net/minecraft/resource/ResourceManager.mapping index 06a74f3f6a..92424b592d 100644 --- a/mappings/net/minecraft/resource/ResourceManager.mapping +++ b/mappings/net/minecraft/resource/ResourceManager.mapping @@ -22,6 +22,8 @@ CLASS net/minecraft/class_3300 net/minecraft/resource/ResourceManager 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 + COMMENT

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 diff --git a/mappings/net/minecraft/resource/ResourcePack.mapping b/mappings/net/minecraft/resource/ResourcePack.mapping index ce6322cbed..1a795fdc9e 100644 --- a/mappings/net/minecraft/resource/ResourcePack.mapping +++ b/mappings/net/minecraft/resource/ResourcePack.mapping @@ -1,4 +1,10 @@ CLASS net/minecraft/class_3262 net/minecraft/resource/ResourcePack + COMMENT A resource pack, providing resources to resource managers. + COMMENT + COMMENT

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 diff --git a/mappings/net/minecraft/resource/ResourcePackManager.mapping b/mappings/net/minecraft/resource/ResourcePackManager.mapping index 9b554fd146..e6431d0e5f 100644 --- a/mappings/net/minecraft/resource/ResourcePackManager.mapping +++ b/mappings/net/minecraft/resource/ResourcePackManager.mapping @@ -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; diff --git a/mappings/net/minecraft/resource/ResourcePackProfile.mapping b/mappings/net/minecraft/resource/ResourcePackProfile.mapping index 3c21a3f73f..8435acf43a 100644 --- a/mappings/net/minecraft/resource/ResourcePackProfile.mapping +++ b/mappings/net/minecraft/resource/ResourcePackProfile.mapping @@ -1,8 +1,17 @@ CLASS net/minecraft/class_3288 net/minecraft/resource/ResourcePackProfile + COMMENT Represents a resource pack in a {@link ResourcePackManager}. + COMMENT + COMMENT

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

The profiles are registered by {@link ResourcePackProvider}s. + COMMENT + COMMENT

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

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 diff --git a/mappings/net/minecraft/resource/ResourcePackProvider.mapping b/mappings/net/minecraft/resource/ResourcePackProvider.mapping index a7b0c239d5..0b3293efcf 100644 --- a/mappings/net/minecraft/resource/ResourcePackProvider.mapping +++ b/mappings/net/minecraft/resource/ResourcePackProvider.mapping @@ -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 diff --git a/mappings/net/minecraft/resource/SimpleResourceReload.mapping b/mappings/net/minecraft/resource/SimpleResourceReload.mapping index d7113e3157..64bafefc37 100644 --- a/mappings/net/minecraft/resource/SimpleResourceReload.mapping +++ b/mappings/net/minecraft/resource/SimpleResourceReload.mapping @@ -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 (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 diff --git a/mappings/net/minecraft/resource/VanillaDataPackProvider.mapping b/mappings/net/minecraft/resource/VanillaDataPackProvider.mapping index 492f77cd8a..a9da4b90ad 100644 --- a/mappings/net/minecraft/resource/VanillaDataPackProvider.mapping +++ b/mappings/net/minecraft/resource/VanillaDataPackProvider.mapping @@ -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;