Interface ResourceLoader
- All Known Subinterfaces:
DataResourceLoader
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.flag.FeatureFlagSet> The resource listener state key for the currently enabled feature flag set.static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.core.HolderLookup.Provider> The resource listener state key for the registry lookupHolderLookup.Provider. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListenerOrdering(net.minecraft.resources.Identifier firstListener, net.minecraft.resources.Identifier secondListener) Requests that reload listeners registered as the first identifier is applied before the other referenced reload listener.static ResourceLoaderget(net.minecraft.server.packs.PackType type) static booleanregisterBuiltinPack(net.minecraft.resources.Identifier id, net.fabricmc.loader.api.ModContainer container, PackActivationType activationType) Registers a built-in resource pack.static booleanregisterBuiltinPack(net.minecraft.resources.Identifier id, net.fabricmc.loader.api.ModContainer container, net.minecraft.network.chat.Component displayName, PackActivationType activationType) Registers a built-in resource pack.voidregisterReloadListener(net.minecraft.resources.Identifier id, net.minecraft.server.packs.resources.PreparableReloadListener listener) Registers a reload listener for a given resource manager type.
-
Field Details
-
REGISTRY_LOOKUP_KEY
static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.core.HolderLookup.Provider> REGISTRY_LOOKUP_KEYThe resource listener state key for the registry lookupHolderLookup.Provider.- API Note:
- The holder lookup is only available in server data reload listeners.
-
FEATURE_FLAG_SET_KEY
static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.flag.FeatureFlagSet> FEATURE_FLAG_SET_KEYThe resource listener state key for the currently enabled feature flag set.- API Note:
- The feature flag set is only available in server data reload listeners.
-
-
Method Details
-
get
-
registerReloadListener
void registerReloadListener(net.minecraft.resources.Identifier id, net.minecraft.server.packs.resources.PreparableReloadListener listener) Registers a reload listener for a given resource manager type.- Parameters:
id- the identifier of the resource listenerlistener- the resource listener- See Also:
-
addListenerOrdering
void addListenerOrdering(net.minecraft.resources.Identifier firstListener, net.minecraft.resources.Identifier secondListener) Requests that reload listeners registered as the first identifier is applied before the other referenced reload listener.Incompatible ordering constraints such as cycles will lead to inconsistent behavior: some constraints will be respected and some will be ignored. If this happens, a warning will be logged.
Please keep in mind that this only takes effect during the application stage!
- Parameters:
firstListener- the identifier of the reload listener that should run before the othersecondListener- the identifier of the reload listener that should run after the other- See Also:
-
registerBuiltinPack
static boolean registerBuiltinPack(net.minecraft.resources.Identifier id, net.fabricmc.loader.api.ModContainer container, PackActivationType activationType) Registers a built-in resource pack.A built-in resource pack is an extra resource pack provided by your mod which is not always active, it's similar to the "Programmer Art" resource pack.
Why and when to use it? A built-in resource pack should be used to provide extra assets/data that should be optional with your mod but still directly provided by it. For example, it could provide textures of your mod in another resolution, or could allow to provide different styles of your assets.
The path in which the resource pack is located is in the mod JAR file under the
"resourcepacks/<id path>"directory.id pathbeing the path specified in the identifier of this built-in resource pack.- Parameters:
id- the identifier of the resource packcontainer- the mod containeractivationType- the activation type of the resource pack- Returns:
trueif successfully registered the resource pack, orfalseotherwise- See Also:
-
registerBuiltinPack
static boolean registerBuiltinPack(net.minecraft.resources.Identifier id, net.fabricmc.loader.api.ModContainer container, net.minecraft.network.chat.Component displayName, PackActivationType activationType) Registers a built-in resource pack.A built-in resource pack is an extra resource pack provided by your mod which is not always active, it's similar to the "Programmer Art" resource pack.
Why and when to use it? A built-in resource pack should be used to provide extra assets/data that should be optional with your mod but still directly provided by it. For example, it could provide textures of your mod in another resolution, or could allow to provide different styles of your assets.
The path in which the resource pack is located is in the mod JAR file under the
"resourcepacks/<id path>"directory.id pathbeing the path specified in the identifier of this built-in resource pack.- Parameters:
id- the identifier of the resource packcontainer- the mod containerdisplayName- the display name of the resource pack, should include mod name for clarityactivationType- the activation type of the resource pack- Returns:
trueif successfully registered the resource pack, orfalseotherwise- See Also:
-