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 reloader store key for the currently enabled feature set.
    static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.core.HolderLookup.Provider>
    The resource reloader store key for the registry lookup.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addReloaderOrdering(net.minecraft.resources.Identifier firstReloader, net.minecraft.resources.Identifier secondReloader)
    Requests that resource reloaders registered as the first identifier is applied before the other referenced resource reloader.
    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
    registerReloader(net.minecraft.resources.Identifier id, net.minecraft.server.packs.resources.PreparableReloadListener reloader)
    Registers a resource reloader for a given resource manager type.
  • Field Details

    • RELOADER_REGISTRY_LOOKUP_KEY

      static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.core.HolderLookup.Provider> RELOADER_REGISTRY_LOOKUP_KEY
      The resource reloader store key for the registry lookup.
      API Note:
      The registry lookup is only available in server data resource reloaders.
    • RELOADER_FEATURE_SET_KEY

      static final net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<net.minecraft.world.flag.FeatureFlagSet> RELOADER_FEATURE_SET_KEY
      The resource reloader store key for the currently enabled feature set.
      API Note:
      The feature set is only available in server data resource reloaders.
  • Method Details

    • get

      static ResourceLoader get(net.minecraft.server.packs.PackType type)
    • registerReloader

      void registerReloader(net.minecraft.resources.Identifier id, net.minecraft.server.packs.resources.PreparableReloadListener reloader)
      Registers a resource reloader for a given resource manager type.
      Parameters:
      id - the identifier of the resource reloader
      reloader - the resource reloader
      See Also:
    • addReloaderOrdering

      void addReloaderOrdering(net.minecraft.resources.Identifier firstReloader, net.minecraft.resources.Identifier secondReloader)
      Requests that resource reloaders registered as the first identifier is applied before the other referenced resource reloader.

      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:
      firstReloader - the identifier of the resource reloader that should run before the other
      secondReloader - the identifier of the resource reloader 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: