Package net.minecraft.resource
Class SinglePreparationResourceReloader<T>
java.lang.Object
net.minecraft.resource.SinglePreparationResourceReloader<T>
- Type Parameters:
T
- the intermediate object type
- All Implemented Interfaces:
ResourceReloader
- Direct Known Subclasses:
CloudRenderer
,FoliageColormapResourceSupplier
,GrassColormapResourceSupplier
,JsonDataLoader
,PeriodicNotificationManager
,ServerRecipeManager
,ShaderLoader
,SoundManager
,SplashTextResourceSupplier
,VideoWarningManager
public abstract class SinglePreparationResourceReloader<T>
extends Object
implements ResourceReloader
A base resource reloader implementation that prepares an object in a
single call (as opposed to in multiple concurrent tasks) and handles
the prepared object in the apply stage.
- Mappings:
Namespace Name named net/minecraft/resource/SinglePreparationResourceReloader
intermediary net/minecraft/class_4080
official awa
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
apply
(T prepared, ResourceManager manager, Profiler profiler) Handles the prepared intermediate object.protected abstract T
prepare
(ResourceManager manager, Profiler profiler) Prepares the intermediate object.final CompletableFuture
<Void> reload
(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) Performs a reload.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.resource.ResourceReloader
getName
-
Constructor Details
-
SinglePreparationResourceReloader
public SinglePreparationResourceReloader()
-
-
Method Details
-
reload
public final CompletableFuture<Void> reload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Executor prepareExecutor, Executor applyExecutor) Performs a reload. Returns a future that is completed when the reload is completed.In a reload, there is a prepare stage and an apply stage. For the prepare stage, you should create completable futures with CompletableFuture.supplyAsync(..., prepareExecutor) to ensure the prepare actions are done with the prepare executor. Then, you should have a completable future for all the prepared actions, and call combinedPrepare.thenCompose(synchronizer::waitFor) to notify the
synchronizer
. Finally, you should run CompletableFuture.thenAcceptAsync(..., applyExecutor) for apply actions. In the end, returns the result ofthenAcceptAsync
.- Specified by:
reload
in interfaceResourceReloader
- Parameters:
synchronizer
- the synchronizermanager
- the resource manager- Returns:
- a future for the reload
- See Also:
- Mappings:
Namespace Name Mixin selector named reload
Lnet/minecraft/resource/ResourceReloader;reload(Lnet/minecraft/resource/ResourceReloader$Synchronizer;Lnet/minecraft/resource/ResourceManager;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
intermediary method_25931
Lnet/minecraft/class_3302;method_25931(Lnet/minecraft/class_3302$class_4045;Lnet/minecraft/class_3300;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
official a
Lavp;a(Lavp$a;Lavv;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
-
prepare
Prepares the intermediate object.This method is called in the prepare executor in a reload.
- Parameters:
manager
- the resource managerprofiler
- the prepare profiler- Returns:
- the prepared object
- Mappings:
Namespace Name Mixin selector named prepare
Lnet/minecraft/resource/SinglePreparationResourceReloader;prepare(Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)Ljava/lang/Object;
intermediary method_18789
Lnet/minecraft/class_4080;method_18789(Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)Ljava/lang/Object;
official b
Lawa;b(Lavv;Lbps;)Ljava/lang/Object;
-
apply
Handles the prepared intermediate object.This method is called in the apply executor, or the game engine, in a reload.
- Parameters:
prepared
- the prepared objectmanager
- the resource managerprofiler
- the apply profiler- Mappings:
Namespace Name Mixin selector named apply
Lnet/minecraft/resource/SinglePreparationResourceReloader;apply(Ljava/lang/Object;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V
intermediary method_18788
Lnet/minecraft/class_4080;method_18788(Ljava/lang/Object;Lnet/minecraft/class_3300;Lnet/minecraft/class_3695;)V
official a
Lawa;a(Ljava/lang/Object;Lavv;Lbps;)V
-