Package net.minecraft.resource
Interface SynchronousResourceReloader
- All Superinterfaces:
ResourceReloader
- All Known Implementing Classes:
BlockRenderManager,GameRenderer,ItemRenderer,LanguageManager,SearchManager,VillagerClothingFeatureRenderer,WorldRenderer
public interface SynchronousResourceReloader extends ResourceReloader
A base resource reloader that does all its work in the apply executor,
or the game engine's thread.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer -
Method Summary
Modifier and Type Method Description voidreload(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:
reloadin 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:
ReloadableResourceManager.reload(Executor, Executor, CompletableFuture, List)
-
reload
Performs the reload in the apply executor, or the game engine.- Parameters:
manager- the resource manager
-