Interface ResourceLoader

All Known Subinterfaces:
DataResourceLoader

@NonExtendable public interface ResourceLoader
Provides various hooks into the resource loader.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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 lookup HolderLookup.Provider.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    get(net.minecraft.server.packs.PackType type)
     
    static boolean
    registerBuiltinPack(net.minecraft.resources.Identifier id, net.fabricmc.loader.api.ModContainer container, PackActivationType activationType)
    Registers a built-in resource pack.
    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.
    void
    registerReloadListener(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_KEY
      The resource listener state key for the registry lookup HolderLookup.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_KEY
      The 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

      static ResourceLoader get(net.minecraft.server.packs.PackType type)
    • 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 listener
      listener - 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 other
      secondListener - 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 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, or false otherwise
      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 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
      displayName - the display name of the resource pack, should include mod name for clarity
      activationType - the activation type of the resource pack
      Returns:
      true if successfully registered the resource pack, or false otherwise
      See Also: