SimpleResourceReloadListener

public interface SimpleResourceReloadListener<T> implements IdentifiableResourceReloadListener

A simplified version of the "resource reload listener" interface, hiding the peculiarities of the API.

In essence, there are two stages:

  • load: create an instance of your data object containing all loaded and processed information,
  • apply: apply the information from the data object to the game instance.

The load stage should be self-contained as it can run on any thread! However, the apply stage is guaranteed to run on the game thread.

For a fully synchronous alternative, consider using SynchronousResourceReloader in conjunction with IdentifiableResourceReloadListener.

Parameters

<T>

The data object.

Functions

apply
Link copied to clipboard
abstract CompletableFuture<Voidapply(T data, ResourceManager manager, Profiler profiler, Executor executor)
Synchronously apply loaded data to the game state.
getFabricDependencies
Link copied to clipboard
Collection<IdentifiergetFabricDependencies()
The identifiers of listeners this listener expects to have beenexecuted before itself.
getFabricId
Link copied to clipboard
abstract Identifier getFabricId()
The unique identifier of this listener.
getName
Link copied to clipboard
String getName()
load
Link copied to clipboard
abstract CompletableFuture<Tload(ResourceManager manager, Profiler profiler, Executor executor)
Asynchronously process and load resource-based data.
reload
Link copied to clipboard
CompletableFuture<Voidreload(ResourceReloader.Synchronizer helper, ResourceManager manager, Profiler loadProfiler, Profiler applyProfiler, Executor loadExecutor, Executor applyExecutor)
abstract CompletableFuture<Voidreload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor, Executor applyExecutor)

Sources

jvm source
Link copied to clipboard