Package net.minecraft.resource
Interface SynchronousResourceReloader
- All Superinterfaces:
ResourceReloader
- All Known Implementing Classes:
BlockEntityRenderDispatcher
,BlockRenderManager
,BuiltinModelItemRenderer
,EntityModelLoader
,EntityRenderDispatcher
,ItemRenderer
,LanguageManager
,SearchManager
,WorldRenderer
A base resource reloader that does all its work in the apply executor,
or the game engine's thread.
- API Note:
- This resource reloader is useful as a resource reload callback that doesn't need resource manager access. If you access the resource manager, consider writing resource reloaders that have a proper prepare stage instead by moving resource manager access to the prepare stage. That can speed up resource reloaders significantly.
- Mappings:
Namespace Name named net/minecraft/resource/SynchronousResourceReloader
intermediary net/minecraft/class_4013
official auq
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
reload
(ResourceManager manager) Performs the reload in the apply executor, or the game engine.default CompletableFuture
<Void> reload
(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor, Executor applyExecutor) Performs a reload.Methods inherited from interface net.minecraft.resource.ResourceReloader
getName
-
Method Details
-
reload
default CompletableFuture<Void> reload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, 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 managerprepareProfiler
- the profiler for prepare stageapplyProfiler
- the profiler for apply stageprepareExecutor
- the executor for prepare stageapplyExecutor
- the executor for apply stage- 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;Lnet/minecraft/util/profiler/Profiler;Lnet/minecraft/util/profiler/Profiler;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;Lnet/minecraft/class_3695;Lnet/minecraft/class_3695;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
official a
Lauj;a(Lauj$a;Laup;Lbnj;Lbnj;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;
-
reload
Performs the reload in the apply executor, or the game engine.- Parameters:
manager
- the resource manager- Mappings:
Namespace Name Mixin selector named reload
Lnet/minecraft/resource/SynchronousResourceReloader;reload(Lnet/minecraft/resource/ResourceManager;)V
intermediary method_14491
Lnet/minecraft/class_4013;method_14491(Lnet/minecraft/class_3300;)V
official a
Lauq;a(Laup;)V
-