Package net.minecraft.resource
Interface SynchronousResourceReloader
- All Superinterfaces:
ResourceReloader
- All Known Implementing Classes:
BlockEntityRenderManager,BlockRenderManager,EntityRenderManager,LanguageManager,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/SynchronousResourceReloaderintermediary net/minecraft/class_4013official baq
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Key<T>, ResourceReloader.Store, ResourceReloader.Synchronizer -
Method Summary
Modifier and TypeMethodDescriptionvoidreload(ResourceManager manager) Performs the reload in the apply executor, or the game engine.default CompletableFuture<Void> reload(ResourceReloader.Store store, Executor prepareExecutor, ResourceReloader.Synchronizer reloadSynchronizer, Executor applyExecutor) Performs a reload.Methods inherited from interface net.minecraft.resource.ResourceReloader
getName, prepareSharedState
-
Method Details
-
reload
default CompletableFuture<Void> reload(ResourceReloader.Store store, Executor prepareExecutor, ResourceReloader.Synchronizer reloadSynchronizer, 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:
reloadin interfaceResourceReloader- Returns:
- a future for the reload
- See Also:
- Mappings:
Namespace Name Mixin selector named reloadLnet/minecraft/resource/ResourceReloader;reload(Lnet/minecraft/resource/ResourceReloader$Store;Ljava/util/concurrent/Executor;Lnet/minecraft/resource/ResourceReloader$Synchronizer;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;intermediary method_25931Lnet/minecraft/class_3302;method_25931(Lnet/minecraft/class_3302$class_11558;Ljava/util/concurrent/Executor;Lnet/minecraft/class_3302$class_4045;Ljava/util/concurrent/Executor;)Ljava/util/concurrent/CompletableFuture;official reloadLbaj;reload(Lbaj$b;Ljava/util/concurrent/Executor;Lbaj$a;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 reloadLnet/minecraft/resource/SynchronousResourceReloader;reload(Lnet/minecraft/resource/ResourceManager;)Vintermediary method_14491Lnet/minecraft/class_4013;method_14491(Lnet/minecraft/class_3300;)Vofficial aLbaq;a(Lbap;)V
-