Interface DataResourceLoader
- All Superinterfaces:
ResourceLoader
Provides various hooks into the server data resource loader.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.server.ServerAdvancementManager> The resource reloader store key for the advancement loader.static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<DataResourceStore.Mutable> The resource reloader store key for the data resource store.static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.item.crafting.RecipeManager> The resource reloader store key for the recipe manager.Fields inherited from interface net.fabricmc.fabric.api.resource.v1.ResourceLoader
RELOADER_FEATURE_SET_KEY, RELOADER_REGISTRY_LOOKUP_KEY -
Method Summary
Modifier and TypeMethodDescriptionstatic DataResourceLoaderget()voidregisterReloader(net.minecraft.resources.Identifier id, Function<net.minecraft.core.HolderLookup.Provider, net.minecraft.server.packs.resources.PreparableReloadListener> factory) Registers a data resource reloader.Methods inherited from interface net.fabricmc.fabric.api.resource.v1.ResourceLoader
addReloaderOrdering, registerReloader
-
Field Details
-
RECIPE_MANAGER_KEY
static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.item.crafting.RecipeManager> RECIPE_MANAGER_KEYThe resource reloader store key for the recipe manager.- API Note:
- The recipe manager is only available in server data resource reloaders.
It should only be accessed in the application phase of the resource reloader, and you should depend onResourceReloaderKeys.Server.RECIPES.
-
ADVANCEMENT_LOADER_KEY
static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.server.ServerAdvancementManager> ADVANCEMENT_LOADER_KEYThe resource reloader store key for the advancement loader.- API Note:
- The advancement loader is only available in server data resource reloaders.
It should only be accessed in the application phase of the resource reloader, and you should depend onResourceReloaderKeys.Server.ADVANCEMENTS.
-
DATA_RESOURCE_STORE_KEY
static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<DataResourceStore.Mutable> DATA_RESOURCE_STORE_KEYThe resource reloader store key for the data resource store.- API Note:
- The data resource store is only available in server data resource reloaders.
It should only be mutated in the application phase of the resource reloader.
-
-
Method Details
-
get
-
registerReloader
void registerReloader(net.minecraft.resources.Identifier id, Function<net.minecraft.core.HolderLookup.Provider, net.minecraft.server.packs.resources.PreparableReloadListener> factory) Registers a data resource reloader.- Parameters:
id- the identifier of the resource reloaderfactory- the factory function of the resource reloader- See Also:
- API Note:
- In most cases
ResourceLoader.registerReloader(Identifier, PreparableReloadListener)is sufficient and should be preferred, but for some resource reloaders likeSimpleJsonResourceReloadListenerconstructing the resource reloader with a known instance of the wrapper lookup is required.
While this may encourage stateful resource reloaders, it is best to primarily use resource reloaders as stateless loaders, as storing a state may easily lead to incomplete or leaking data.
-