Interface ResourceManagerHelper


public interface ResourceManagerHelper
Helper for working with ResourceManager instances, and other resource loader generalities.
  • Method Details

    • addReloadListener

      @Deprecated default void addReloadListener(IdentifiableResourceReloadListener listener)
      Add a resource reload listener for a given registry.
      Parameters:
      listener - The resource reload listener.
    • registerReloadListener

      void registerReloadListener(IdentifiableResourceReloadListener listener)
      Register a resource reload listener for a given resource manager type.
      Parameters:
      listener - The resource reload listener.
    • get

      static ResourceManagerHelper get(net.minecraft.resource.ResourceType type)
      Get the ResourceManagerHelper instance for a given resource type.
      Parameters:
      type - The given resource type.
      Returns:
      The ResourceManagerHelper instance.
    • registerBuiltinResourcePack

      static boolean registerBuiltinResourcePack(net.minecraft.util.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 pack
      container - the mod container
      activationType - the activation type of the resource pack
      Returns:
      true if successfully registered the resource pack, else false
    • registerBuiltinResourcePack

      @Deprecated static boolean registerBuiltinResourcePack(net.minecraft.util.Identifier id, String subPath, net.fabricmc.loader.api.ModContainer container, boolean enabledByDefault)
      Deprecated.
      Please use registerBuiltinResourcePack(Identifier, ModContainer, ResourcePackActivationType) instead, the sub 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 pack
      subPath - the sub path in the mod resources
      container - the mod container
      enabledByDefault - true if enabled by default, else false
      Returns:
      true if successfully registered the resource pack, else false