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 ClassesModifier and TypeInterfaceDescriptionstatic final classSpriteProvider.Wrapper<T extends SpriteProvider<T>> -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.resources.ResourceLocationgetSources(ResourceGenerationContext context) static <T extends SpriteProvider<T>>
voidregister(net.minecraft.resources.ResourceLocation location, com.mojang.serialization.MapCodec<T> codec) Registers a sprite source type.static <T extends SpriteProvider<T>>
voidRegisters a sprite source typedefault voidreset(ResourceGenerationContext context) Will be run before generation starts.default voidrun(net.minecraft.server.packs.resources.ResourceManager resourceManager, net.minecraft.client.renderer.texture.atlas.SpriteSource.Output output, net.minecraft.resources.ResourceLocation cacheName) default SpriteProvider.Wrapper<T> wrap()
-
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 withcodec- 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 withconstructor- supplies instances of this sprite source type
-
reset
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
-