Class SimpleResourceReloader<T>
java.lang.Object
net.fabricmc.fabric.api.resource.v1.reloader.SimpleResourceReloader<T>
- Type Parameters:
T- the data object
- All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener
public abstract class SimpleResourceReloader<T>
extends Object
implements net.minecraft.server.packs.resources.PreparableReloadListener
A variant of
SimplePreparableReloadListener
which passes the shared state store instead of the resource manager in its methods.
In essence, there are two stages:
- prepare: 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 prepare 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
ResourceManagerReloadListener.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier, net.minecraft.server.packs.resources.PreparableReloadListener.SharedState, net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidSynchronously applies prepared data to the game state.protected abstract Tprepare(net.minecraft.server.packs.resources.PreparableReloadListener.SharedState store) Asynchronously processes and prepares resource-based data.final CompletableFuture<Void> reload(net.minecraft.server.packs.resources.PreparableReloadListener.SharedState store, Executor prepareExecutor, net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier reloadSynchronizer, Executor applyExecutor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
getName, prepareSharedState
-
Constructor Details
-
SimpleResourceReloader
public SimpleResourceReloader()
-
-
Method Details