Interface ResourceManagerHelper
ResourceManager
instances, and other resource loader generalities.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Deprecated.static ResourceManagerHelper
get
(ResourceType type) Get the ResourceManagerHelper instance for a given resource type.static boolean
registerBuiltinResourcePack
(Identifier id, String subPath, net.fabricmc.loader.api.ModContainer container, boolean enabledByDefault) Deprecated.Please useregisterBuiltinResourcePack(Identifier, ModContainer, ResourcePackActivationType)
instead, thesub path
should be removed in a future release in favor of the identifier path.static boolean
registerBuiltinResourcePack
(Identifier id, net.fabricmc.loader.api.ModContainer container, String displayName, ResourcePackActivationType activationType) Deprecated.static boolean
registerBuiltinResourcePack
(Identifier id, net.fabricmc.loader.api.ModContainer container, ResourcePackActivationType activationType) Registers a built-in resource pack.static boolean
registerBuiltinResourcePack
(Identifier id, net.fabricmc.loader.api.ModContainer container, Text displayName, ResourcePackActivationType activationType) Registers a built-in resource pack.void
Register a resource reload listener for a given resource manager type.void
registerReloadListener
(Identifier identifier, Function<RegistryWrapper.WrapperLookup, IdentifiableResourceReloadListener> listenerFactory) Register a resource reload listener for a given resource manager type.
-
Method Details
-
addReloadListener
Deprecated.Add a resource reload listener for a given registry.- Parameters:
listener
- The resource reload listener.
-
registerReloadListener
Register a resource reload listener for a given resource manager type.- Parameters:
listener
- The resource reload listener.
-
registerReloadListener
void registerReloadListener(Identifier identifier, Function<RegistryWrapper.WrapperLookup, IdentifiableResourceReloadListener> listenerFactory) Register a resource reload listener for a given resource manager type.Note: This is only supported for server data reload listeners.
- Parameters:
identifier
- The identifier of the listener.listenerFactory
- A function that creates a new instance of the listener with a given registry lookup.
-
get
Get the ResourceManagerHelper instance for a given resource type.- Parameters:
type
- The given resource type.- Returns:
- The ResourceManagerHelper instance.
-
registerBuiltinResourcePack
static boolean registerBuiltinResourcePack(Identifier id, net.fabricmc.loader.api.ModContainer container, ResourcePackActivationType 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 path
being 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:
true
if successfully registered the resource pack, elsefalse
-
registerBuiltinResourcePack
static boolean registerBuiltinResourcePack(Identifier id, net.fabricmc.loader.api.ModContainer container, Text displayName, ResourcePackActivationType 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 path
being 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:
true
if successfully registered the resource pack, elsefalse
-
registerBuiltinResourcePack
@Deprecated static boolean registerBuiltinResourcePack(Identifier id, net.fabricmc.loader.api.ModContainer container, String displayName, ResourcePackActivationType activationType) Deprecated.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 path
being 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:
true
if successfully registered the resource pack, elsefalse
-
registerBuiltinResourcePack
@Deprecated static boolean registerBuiltinResourcePack(Identifier id, String subPath, net.fabricmc.loader.api.ModContainer container, boolean enabledByDefault) Deprecated.Please useregisterBuiltinResourcePack(Identifier, ModContainer, ResourcePackActivationType)
instead, thesub path
should be removed in a future release in favor of the identifier path.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
subPath
corresponds to a path in the JAR file which points to the resource pack folder. For example the subPath can be"resourcepacks/extra"
.Note about the enabled by default parameter: a resource pack cannot be enabled by default, only data packs can. Making this work for resource packs is near impossible without touching how Vanilla handles disabled resource packs.
- Parameters:
id
- the identifier of the resource packsubPath
- the sub path in the mod resourcescontainer
- the mod containerenabledByDefault
-true
if enabled by default, elsefalse
- Returns:
true
if successfully registered the resource pack, elsefalse
-
registerReloadListener(IdentifiableResourceReloadListener)