Resource reload renames (#2131)

* Resource reload renames

Fixes #920

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

* Update some stuff for 11a

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

Co-authored-by: liach <liach@users.noreply.github.com>
This commit is contained in:
liach 2021-03-25 01:19:56 +07:00 committed by GitHub
parent 87ebde22cc
commit 4c9fd21882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 235 additions and 71 deletions

View File

@ -1,11 +1,11 @@
CLASS net/minecraft/class_425 net/minecraft/client/gui/screen/SplashScreen
FIELD field_17767 reloadMonitor Lnet/minecraft/class_4011;
FIELD field_17767 reload Lnet/minecraft/class_4011;
FIELD field_17770 progress F
FIELD field_17771 applyCompleteTime J
FIELD field_17771 reloadCompleteTime J
FIELD field_18217 client Lnet/minecraft/class_310;
FIELD field_18218 exceptionHandler Ljava/util/function/Consumer;
FIELD field_18219 reloading Z
FIELD field_18220 prepareCompleteTime J
FIELD field_18220 reloadStartTime J
FIELD field_2483 LOGO Lnet/minecraft/class_2960;
FIELD field_25041 BRAND_ARGB I
FIELD field_25042 BRAND_RGB I

View File

@ -1,4 +1,6 @@
CLASS net/minecraft/class_4309 net/minecraft/resource/JsonDataLoader
COMMENT An abstract implementation of resource reloader that reads JSON files
COMMENT into Gson representations in the prepare stage.
FIELD field_19377 LOGGER Lorg/apache/logging/log4j/Logger;
FIELD field_19378 FILE_SUFFIX_LENGTH I
FIELD field_19379 gson Lcom/google/gson/Gson;

View File

@ -1,17 +1,28 @@
CLASS net/minecraft/class_4010 net/minecraft/resource/ProfilingResourceReloader
CLASS net/minecraft/class_4010 net/minecraft/resource/ProfiledResourceReload
COMMENT An implementation of resource reload that includes an additional profiling
COMMENT summary for each reloader.
FIELD field_17918 LOGGER Lorg/apache/logging/log4j/Logger;
FIELD field_17919 reloadTimer Lcom/google/common/base/Stopwatch;
METHOD <init> (Lnet/minecraft/class_3300;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)V
ARG 1 manager
ARG 2 listeners
ARG 2 reloaders
ARG 3 prepareExecutor
ARG 4 applyExecutor
ARG 5 initialStage
METHOD method_18238 finish (Ljava/util/List;)V
ARG 1 summaries
METHOD method_18354 (Ljava/util/concurrent/Executor;Ljava/util/concurrent/atomic/AtomicLong;Ljava/lang/Runnable;)V
ARG 2 application
METHOD method_18355 (Ljava/util/concurrent/Executor;Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Lnet/minecraft/class_3302;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
ARG 4 prepareExecutor
ARG 5 applyExecutor
ARG 1 synchronizer
ARG 2 resourceManager
ARG 3 reloader
ARG 4 prepare
ARG 5 apply
METHOD method_18358 (Ljava/util/concurrent/Executor;Ljava/util/concurrent/atomic/AtomicLong;Ljava/lang/Runnable;)V
ARG 2 preparation
CLASS class_4046 Summary
COMMENT The profiling summary for each reloader in the reload.
FIELD field_18037 name Ljava/lang/String;
FIELD field_18038 prepareProfile Lnet/minecraft/class_3696;
FIELD field_18039 applyProfile Lnet/minecraft/class_3696;

View File

@ -1,13 +1,46 @@
CLASS net/minecraft/class_3296 net/minecraft/resource/ReloadableResourceManager
METHOD method_14477 registerListener (Lnet/minecraft/class_3302;)V
ARG 1 listener
METHOD method_14478 beginReload (Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/List;Ljava/util/concurrent/CompletableFuture;)Ljava/util/concurrent/CompletableFuture;
COMMENT A resource manager that has a reload mechanism. Reloading allows
COMMENT reloaders to update when resources change. Accessing resources in
COMMENT reloads can reduce impact on game performance as well.
COMMENT
COMMENT <p>In each reload, all reloaders in this resource manager will have
COMMENT their {@linkplain ResourceReloader#reload reload} called.
COMMENT
COMMENT @see ResourceReloader
METHOD method_14477 registerReloader (Lnet/minecraft/class_3302;)V
COMMENT Registers a resource reloader to this manager.
ARG 1 reloader
COMMENT the reloader
METHOD method_14478 reload (Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/List;Ljava/util/concurrent/CompletableFuture;)Ljava/util/concurrent/CompletableFuture;
COMMENT Performs a reload. This returns a future that is completed when the
COMMENT reload is completed.
COMMENT
COMMENT @return the future of the reload
COMMENT @see #reload(Executor, Executor, CompletableFuture, List)
ARG 1 prepareExecutor
COMMENT an executor for the prepare stage
ARG 2 applyExecutor
COMMENT an executor for the apply stage
ARG 3 packs
COMMENT a list of resource packs providing resources
ARG 4 initialStage
METHOD method_18232 beginMonitoredReload (Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/class_4011;
COMMENT a completable future to be completed before this reload
METHOD method_18232 reload (Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Ljava/util/List;)Lnet/minecraft/class_4011;
COMMENT Performs a reload. Returns an object that yields some insights to the
COMMENT reload.
COMMENT
COMMENT <p>{@code prepareExecutor} may be asynchronous. {@code applyExecutor} must
COMMENT synchronize with the game engine so changes are properly made to it.
COMMENT The reload will only begin after {@code initialStage} has completed.
COMMENT Earlier elements in {@code packs} have lower priorities.
COMMENT
COMMENT @return the reload
COMMENT @see ResourceReloader#reload
ARG 1 prepareExecutor
COMMENT an executor for the prepare stage
ARG 2 applyExecutor
COMMENT an executor for the apply stage
ARG 3 initialStage
COMMENT a completable future to be completed before this reload
ARG 4 packs
COMMENT a list of resource packs providing resources

View File

@ -3,14 +3,14 @@ CLASS net/minecraft/class_3304 net/minecraft/resource/ReloadableResourceManagerI
FIELD field_14293 namespaceManagers Ljava/util/Map;
FIELD field_14294 type Lnet/minecraft/class_3264;
FIELD field_14295 LOGGER Lorg/apache/logging/log4j/Logger;
FIELD field_17935 listeners Ljava/util/List;
FIELD field_17935 reloaders Ljava/util/List;
FIELD field_25145 packs Ljava/util/List;
METHOD <init> (Lnet/minecraft/class_3264;)V
ARG 1 type
METHOD method_14475 addPack (Lnet/minecraft/class_3262;)V
ARG 1 pack
METHOD method_14495 clear ()V
CLASS class_4742 FailedResourceReloadMonitor
CLASS class_4742 FailedReload
FIELD field_21810 exception Lnet/minecraft/class_3304$class_4743;
FIELD field_21811 future Ljava/util/concurrent/CompletableFuture;
METHOD <init> (Lnet/minecraft/class_3304$class_4743;)V

View File

@ -0,0 +1,16 @@
CLASS net/minecraft/class_4011 net/minecraft/resource/ResourceReload
COMMENT Represents a resource reload.
COMMENT
COMMENT @see ReloadableResourceManager#reload(java.util.concurrent.Executor,
COMMENT java.util.concurrent.Executor, CompletableFuture, java.util.List)
METHOD method_18229 getProgress ()F
COMMENT Returns a fraction between 0 and 1 indicating the progress of this
COMMENT reload.
METHOD method_18364 whenComplete ()Ljava/util/concurrent/CompletableFuture;
COMMENT Returns a future for the reload. The returned future is completed when
COMMENT the reload completes.
METHOD method_18787 isComplete ()Z
COMMENT Returns if this reload has completed, either normally or abnormally.
METHOD method_18849 throwException ()V
COMMENT Throws an unchecked exception from this reload, if there is any. Does
COMMENT nothing if the reload has not completed or terminated.

View File

@ -1,12 +0,0 @@
CLASS net/minecraft/class_3302 net/minecraft/resource/ResourceReloadListener
METHOD method_22322 getName ()Ljava/lang/String;
METHOD method_25931 reload (Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;Lnet/minecraft/class_3695;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
ARG 1 synchronizer
ARG 2 manager
ARG 3 prepareProfiler
ARG 4 applyProfiler
ARG 5 prepareExecutor
ARG 6 applyExecutor
CLASS class_4045 Synchronizer
METHOD method_18352 whenPrepared (Ljava/lang/Object;)Ljava/util/concurrent/CompletableFuture;
ARG 1 preparedObject

View File

@ -1,5 +0,0 @@
CLASS net/minecraft/class_4011 net/minecraft/resource/ResourceReloadMonitor
METHOD method_18229 getProgress ()F
METHOD method_18364 whenComplete ()Ljava/util/concurrent/CompletableFuture;
METHOD method_18787 isApplyStageComplete ()Z
METHOD method_18849 throwExceptions ()V

View File

@ -1,30 +1,65 @@
CLASS net/minecraft/class_4014 net/minecraft/resource/ResourceReloader
FIELD field_17927 manager Lnet/minecraft/class_3300;
FIELD field_18042 prepareStageFuture Ljava/util/concurrent/CompletableFuture;
FIELD field_18043 applyStageFuture Ljava/util/concurrent/CompletableFuture;
FIELD field_18044 waitingListeners Ljava/util/Set;
FIELD field_18045 listenerCount I
FIELD field_18046 applyingCount I
FIELD field_18047 appliedCount I
FIELD field_18048 preparingCount Ljava/util/concurrent/atomic/AtomicInteger;
FIELD field_18049 preparedCount Ljava/util/concurrent/atomic/AtomicInteger;
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
ARG 3 manager
ARG 4 listeners
ARG 5 creator
ARG 6 initialStage
METHOD method_18369 create (Lnet/minecraft/class_3300;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/class_4014;
ARG 0 manager
ARG 1 listeners
ARG 2 prepareExecutor
ARG 3 applyExecutor
ARG 4 initialStage
CLASS class_4047 Factory
METHOD create (Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Lnet/minecraft/class_3302;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
ARG 1 helper
ARG 2 manager
ARG 3 listener
ARG 4 prepareExecutor
ARG 5 applyExecutor
CLASS net/minecraft/class_3302 net/minecraft/resource/ResourceReloader
COMMENT A resource reloader performs actual reloading in its {@linkplain #reload
COMMENT reload} in a reloadable resource manager it is registered to.
COMMENT
COMMENT @see ReloadableResourceManager
COMMENT @see SinglePreparationResourceReloader SinglePreparationResourceReloader
COMMENT (completes preparation in one method)
COMMENT @see SynchronousResourceReloader SynchronousResourceReloader
COMMENT (performs all reloading in the apply executor)
METHOD method_22322 getName ()Ljava/lang/String;
COMMENT Returns a user-friendly name for logging.
METHOD method_25931 reload (Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;Lnet/minecraft/class_3695;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
COMMENT Performs a reload. Returns a future that is completed when the reload
COMMENT is completed.
COMMENT
COMMENT <p>In a reload, there is a prepare stage and an apply stage. For the
COMMENT prepare stage, you should create completable futures with {@linkplain
COMMENT CompletableFuture#supplyAsync(Supplier, Executor)
COMMENT CompletableFuture.supplyAsync(..., prepareExecutor)}
COMMENT to ensure the prepare actions are done with the prepare executor. Then,
COMMENT you should have a completable future for all the prepared actions, and
COMMENT call {@linkplain CompletableFuture#thenCompose(Function)
COMMENT combinedPrepare.thenCompose(synchronizer::waitFor)}
COMMENT to notify the {@code synchronizer}. Finally, you should run {@linkplain
COMMENT CompletableFuture#thenAcceptAsync(Consumer, Executor)
COMMENT CompletableFuture.thenAcceptAsync(..., applyExecutor)} for apply actions.
COMMENT In the end, returns the result of {@code thenAcceptAsync}.
COMMENT
COMMENT @return a future for the reload
COMMENT @see ReloadableResourceManager#reload(Executor, Executor,
COMMENT CompletableFuture, List)
ARG 1 synchronizer
COMMENT the synchronizer
ARG 2 manager
COMMENT the resource manager
ARG 3 prepareProfiler
COMMENT the profiler for prepare stage
ARG 4 applyProfiler
COMMENT the profiler for apply stage
ARG 5 prepareExecutor
COMMENT the executor for prepare stage
ARG 6 applyExecutor
COMMENT the executor for apply stage
CLASS class_4045 Synchronizer
COMMENT A synchronizer to indicate completion of a reloader's prepare stage and
COMMENT to allow start of the apply stage only if all reloaders have finished
COMMENT the prepare stage.
METHOD method_18352 whenPrepared (Ljava/lang/Object;)Ljava/util/concurrent/CompletableFuture;
COMMENT Indicates, to the ongoing reload, that this reloader has finished its
COMMENT preparation stage with the {@code preparedObject} as its result.
COMMENT
COMMENT <p>Returns a completable future that the apply stage depends on. This
COMMENT returned future is completed when all the reloaders have completed their
COMMENT prepare stages in the reload.
COMMENT
COMMENT <p>Example:
COMMENT {@code
COMMENT CompletableFuture<SomeObject> prepareStage = ...;
COMMENT prepareStage.thenCompose(synchronizer::whenPrepared)
COMMENT .thenAcceptAsync(..., applyExecutor);
COMMENT }
COMMENT
COMMENT @return a completable future as the precondition for the apply stage
ARG 1 preparedObject
COMMENT the result of the prepare stage

View File

@ -1,4 +1,5 @@
CLASS net/minecraft/class_5350 net/minecraft/resource/ServerResourceManager
FIELD field_25334 COMPLETED_UNIT Ljava/util/concurrent/CompletableFuture;
FIELD field_25335 resourceManager Lnet/minecraft/class_3296;
FIELD field_25336 commandManager Lnet/minecraft/class_2170;
FIELD field_25337 recipeManager Lnet/minecraft/class_1863;
@ -10,10 +11,16 @@ CLASS net/minecraft/class_5350 net/minecraft/resource/ServerResourceManager
FIELD field_28017 lootFunctionManager Lnet/minecraft/class_5640;
METHOD <init> (Lnet/minecraft/class_5455;Lnet/minecraft/class_2170$class_5364;I)V
ARG 1 registryManager
ARG 2 commandEnvironment
ARG 3 functionPermissionLevel
METHOD method_29465 getFunctionLoader ()Lnet/minecraft/class_5349;
METHOD method_29466 reload (Ljava/util/List;Lnet/minecraft/class_5455;Lnet/minecraft/class_2170$class_5364;ILjava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
ARG 0 packs
ARG 1 registryManager
ARG 2 commandEnvironment
ARG 3 functionPermissionLevel
ARG 4 prepareExecutor
ARG 5 applyExecutor
METHOD method_29468 getLootConditionManager ()Lnet/minecraft/class_4567;
METHOD method_29469 getLootManager ()Lnet/minecraft/class_60;
METHOD method_29470 getRegistryTagManager ()Lnet/minecraft/class_5415;

View File

@ -0,0 +1,48 @@
CLASS net/minecraft/class_4014 net/minecraft/resource/SimpleResourceReload
COMMENT A simple implementation of resource reload.
COMMENT
COMMENT @param <S> the result type for each reloader in the reload
FIELD field_17927 manager Lnet/minecraft/class_3300;
FIELD field_18042 prepareStageFuture Ljava/util/concurrent/CompletableFuture;
FIELD field_18043 applyStageFuture Ljava/util/concurrent/CompletableFuture;
FIELD field_18044 waitingReloaders Ljava/util/Set;
FIELD field_18045 reloaderCount I
FIELD field_18046 toApplyCount I
FIELD field_18047 appliedCount I
FIELD field_18048 toPrepareCount Ljava/util/concurrent/atomic/AtomicInteger;
FIELD field_18049 preparedCount Ljava/util/concurrent/atomic/AtomicInteger;
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
ARG 3 manager
ARG 4 reloaders
ARG 5 factory
ARG 6 initialStage
METHOD method_18366 (Ljava/util/List;)Lnet/minecraft/class_3902;
ARG 0 results
METHOD method_18367 (Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V
ARG 2 application
METHOD method_18368 (Ljava/util/concurrent/Executor;Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Lnet/minecraft/class_3302;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
ARG 1 synchronizer
ARG 2 resourceManager
ARG 3 reloader
ARG 4 prepare
ARG 5 apply
METHOD method_18369 create (Lnet/minecraft/class_3300;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;)Lnet/minecraft/class_4014;
COMMENT Creates a simple resource reload without additional results.
ARG 0 manager
ARG 1 reloaders
ARG 2 prepareExecutor
ARG 3 applyExecutor
ARG 4 initialStage
METHOD method_18372 (Ljava/util/concurrent/Executor;Ljava/lang/Runnable;)V
ARG 2 preparation
CLASS class_4047 Factory
COMMENT A factory that creates a completable future for each reloader in the
COMMENT resource reload.
METHOD create (Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Lnet/minecraft/class_3302;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
ARG 1 synchronizer
ARG 2 manager
ARG 3 reloader
ARG 4 prepareExecutor
ARG 5 applyExecutor

View File

@ -1,8 +0,0 @@
CLASS net/minecraft/class_4080 net/minecraft/resource/SinglePreparationResourceReloadListener
METHOD method_18788 apply (Ljava/lang/Object;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)V
ARG 1 loader
ARG 2 manager
ARG 3 profiler
METHOD method_18789 prepare (Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)Ljava/lang/Object;
ARG 1 manager
ARG 2 profiler

View File

@ -0,0 +1,27 @@
CLASS net/minecraft/class_4080 net/minecraft/resource/SinglePreparationResourceReloader
COMMENT A base resource reloader implementation that prepares an object in a
COMMENT single call (as opposed to in multiple concurrent tasks) and handles
COMMENT the prepared object in the apply stage.
COMMENT
COMMENT @param <T> the intermediate object type
METHOD method_18788 apply (Ljava/lang/Object;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)V
COMMENT Handles the prepared intermediate object.
COMMENT
COMMENT <p>This method is called in the apply executor, or the game engine, in a
COMMENT reload.
ARG 1 prepared
COMMENT the prepared object
ARG 2 manager
COMMENT the resource manager
ARG 3 profiler
COMMENT the apply profiler
METHOD method_18789 prepare (Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)Ljava/lang/Object;
COMMENT Prepares the intermediate object.
COMMENT
COMMENT <p>This method is called in the prepare executor in a reload.
COMMENT
COMMENT @return the prepared object
ARG 1 manager
COMMENT the resource manager
ARG 2 profiler
COMMENT the prepare profiler

View File

@ -1,3 +0,0 @@
CLASS net/minecraft/class_4013 net/minecraft/resource/SynchronousResourceReloadListener
METHOD method_14491 apply (Lnet/minecraft/class_3300;)V
ARG 1 manager

View File

@ -0,0 +1,13 @@
CLASS net/minecraft/class_4013 net/minecraft/resource/SynchronousResourceReloader
COMMENT A base resource reloader that does all its work in the apply executor,
COMMENT or the game engine's thread.
COMMENT
COMMENT @apiNote This resource reloader is useful as a resource reload callback
COMMENT that doesn't need resource manager access. If you access the resource
COMMENT manager, consider writing resource reloaders that have a proper prepare
COMMENT stage instead by moving resource manager access to the prepare stage.
COMMENT That can speed up resource reloaders significantly.
METHOD method_14491 reload (Lnet/minecraft/class_3300;)V
COMMENT Performs the reload in the apply executor, or the game engine.
ARG 1 manager
COMMENT the resource manager