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 reload listener state key for the advancement loader.static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<DataResourceStore.Mutable> The reload listener state key for the data resource store.static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.item.crafting.RecipeManager> The reload listener state key for the recipe manager.Fields inherited from interface ResourceLoader
FEATURE_FLAG_SET_KEY, REGISTRY_LOOKUP_KEY -
Method Summary
Modifier and TypeMethodDescriptionstatic DataResourceLoaderget()voidregisterReloadListener(net.minecraft.resources.Identifier id, Function<net.minecraft.core.HolderLookup.Provider, net.minecraft.server.packs.resources.PreparableReloadListener> factory) Registers a data reload listener.Methods inherited from interface ResourceLoader
addListenerOrdering, registerReloadListener
-
Field Details
-
RECIPE_MANAGER_KEY
static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.item.crafting.RecipeManager> RECIPE_MANAGER_KEYThe reload listener state key for the recipe manager.- API Note:
- The recipe manager is only available in server data reload listeners.
It should only be accessed in the application phase of the reload listeners, 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 reload listener state key for the advancement loader.- API Note:
- The advancement loader is only available in server data reload listeners.
It should only be accessed in the application phase of the reload listeners, 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 reload listener state key for the data resource store.- API Note:
- The data resource store is only available in server data reload listeners.
It should only be mutated in the application phase of the reload listeners.
-
-
Method Details
-
get
-
registerReloadListener
void registerReloadListener(net.minecraft.resources.Identifier id, Function<net.minecraft.core.HolderLookup.Provider, net.minecraft.server.packs.resources.PreparableReloadListener> factory) Registers a data reload listener.- Parameters:
id- the identifier of the reload listenerfactory- the factory function of the reload listener- See Also:
- API Note:
- In most cases
ResourceLoader.registerReloadListener(Identifier, PreparableReloadListener)is sufficient and should be preferred, but for some reload listeners likeSimpleJsonResourceReloadListenerconstructing the reload listener with a known instance of the holder lookup is required.
While this may encourage stateful reload listeners, it is best to primarily use reload listeners as stateless loaders, as storing a state may easily lead to incomplete or leaking data.
-