Interface SpriteProvider<T extends SpriteProvider<T>>


public interface SpriteProvider<T extends SpriteProvider<T>>
A sprite source which makes use of TexSources to provide sprites at resource pack load. May be more reliable than a AssetResourceCache for generating sprites based off of textures added by other mods which use runtime resource generation techniques.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.resources.ResourceLocation
     
    Map<net.minecraft.resources.ResourceLocation,TexSource>
     
    static <T extends SpriteProvider<T>>
    void
    register(net.minecraft.resources.ResourceLocation location, com.mojang.serialization.MapCodec<T> codec)
    Registers a sprite source type.
    static <T extends SpriteProvider<T>>
    void
    register(net.minecraft.resources.ResourceLocation location, Supplier<T> constructor)
    Registers a sprite source type
    default void
    Will be run before generation starts.
    default void
    run(net.minecraft.server.packs.resources.ResourceManager resourceManager, net.minecraft.client.renderer.texture.atlas.SpriteSource.Output output, net.minecraft.resources.ResourceLocation cacheName)
     
     
  • Method Details

    • getSources

      Map<net.minecraft.resources.ResourceLocation,TexSource> getSources(ResourceGenerationContext context)
      Returns:
      a map of texture location, not including the "textures/" prefix or file extension, to texture source
    • getLocation

      net.minecraft.resources.ResourceLocation getLocation()
      Returns:
      a unique identifier for this sprite source type
    • register

      static <T extends SpriteProvider<T>> void register(net.minecraft.resources.ResourceLocation location, com.mojang.serialization.MapCodec<T> codec)
      Registers a sprite source type.
      Parameters:
      location - the location which this sprite source type can be referenced from a texture atlas JSON file with
      codec - a codec to provide instances of the type
    • register

      static <T extends SpriteProvider<T>> void register(net.minecraft.resources.ResourceLocation location, Supplier<T> constructor)
      Registers a sprite source type
      Parameters:
      location - the location which this sprite source type can be referenced from a texture atlas JSON file with
      constructor - supplies instances of this sprite source type
    • reset

      default void reset(ResourceGenerationContext context)
      Will be run before generation starts. Allows for clearing of anything that saves state (caches or the like). Implementations should call the super method to clear texture source and palette transfer caches.
      Parameters:
      context - context for the generation that will occur after this source is reset
    • run

      default void run(net.minecraft.server.packs.resources.ResourceManager resourceManager, net.minecraft.client.renderer.texture.atlas.SpriteSource.Output output, net.minecraft.resources.ResourceLocation cacheName)
    • wrap

      default SpriteProvider.Wrapper<T> wrap()