Package net.minecraft.client.texture
Class TextureManager
java.lang.Object
net.minecraft.client.texture.TextureManager
- All Implemented Interfaces:
AutoCloseable,TextureTickListener,ResourceReloader
@Environment(CLIENT) public class TextureManager extends Object implements ResourceReloader, TextureTickListener, AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer -
Field Summary
Fields Modifier and Type Field Description private Map<String,Integer>dynamicIdCountersprivate static LoggerLOGGERstatic IdentifierMISSING_IDENTIFIERprivate ResourceManagerresourceContainerprivate Map<Identifier,AbstractTexture>texturesprivate Set<TextureTickListener>tickListeners -
Constructor Summary
Constructors Constructor Description TextureManager(ResourceManager resourceManager) -
Method Summary
Modifier and Type Method Description voidbindTexture(Identifier id)private voidbindTextureInner(Identifier id)voidclose()voiddestroyTexture(Identifier id)AbstractTexturegetTexture(Identifier id)CompletableFuture<Void>loadTextureAsync(Identifier id, Executor executor)private AbstractTexturemethod_24303(Identifier identifier, AbstractTexture abstractTexture)private voidmethod_30299(Identifier identifier, AbstractTexture abstractTexture)IdentifierregisterDynamicTexture(String prefix, NativeImageBackedTexture texture)voidregisterTexture(Identifier id, AbstractTexture texture)CompletableFuture<Void>reload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor, Executor applyExecutor)Performs a reload.private static voidrunOnRenderThread(Runnable runnable)voidtick()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.resource.ResourceReloader
getName
-
Field Details
-
LOGGER
-
MISSING_IDENTIFIER
-
textures
-
tickListeners
-
dynamicIdCounters
-
resourceContainer
-
-
Constructor Details
-
TextureManager
-
-
Method Details
-
bindTexture
-
bindTextureInner
-
registerTexture
-
method_30299
-
method_24303
-
getTexture
-
registerDynamicTexture
-
loadTextureAsync
-
runOnRenderThread
-
tick
public void tick()- Specified by:
tickin interfaceTextureTickListener
-
destroyTexture
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
reload
public 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)
-