Interface TextureProvider

All Known Implementing Classes:
FallbackTextureProvider, PlayerSkinURLTextureProvider, URLTextureProvider

public interface TextureProvider
An interfaced used for converting data into an ResourceLocation to be rendered as a texture
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<TextureProvider>
     
    static final com.mojang.serialization.Codec<TextureProvider>
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addScreenButtons(net.minecraft.client.gui.Font font, net.minecraft.client.gui.layouts.GridLayout.RowHelper rowHelper, Consumer<TextureProvider> updateHandler)
     
    com.mojang.serialization.Codec<? extends TextureProvider>
    The codec for reading the texture provider
    net.minecraft.resources.ResourceLocation
    The resource location of the texture that will be rendered
    default boolean
    If the texture represents no resource
    Should default to false
    playerSkinURL(String url, net.minecraft.resources.ResourceLocation target)
    Crates a URL texture provider
    Creates a resource texture provider
    resource(String target)
    Creates a resource texture provider
    resource(net.minecraft.resources.ResourceLocation target)
    Creates a resource texture provider
    url(String url, net.minecraft.resources.ResourceLocation target)
    Crates a URL texture provider
    default boolean
    If the texture being used is a default resource because the real resource could not be found in the files
    Should default to false
  • Field Details

    • DIRECT_CODEC

      static final com.mojang.serialization.Codec<TextureProvider> DIRECT_CODEC
    • CODEC

      static final com.mojang.serialization.Codec<TextureProvider> CODEC
  • Method Details

    • codec

      com.mojang.serialization.Codec<? extends TextureProvider> codec()
      The codec for reading the texture provider
      Returns:
      The codec
    • getTexture

      net.minecraft.resources.ResourceLocation getTexture()
      The resource location of the texture that will be rendered
      Returns:
      The resource location
    • usingFallback

      default boolean usingFallback()
      If the texture being used is a default resource because the real resource could not be found in the files
      Should default to false
      Returns:
      Returns true when unable to locate the required resource
    • isNone

      default boolean isNone()
      If the texture represents no resource
      Should default to false
      Returns:
      Returns true when equal to "texture/none"
    • addScreenButtons

      void addScreenButtons(net.minecraft.client.gui.Font font, net.minecraft.client.gui.layouts.GridLayout.RowHelper rowHelper, Consumer<TextureProvider> updateHandler)
    • url

      static TextureProvider url(String url, net.minecraft.resources.ResourceLocation target)
      Crates a URL texture provider
      Parameters:
      url - The URL of the texture
      target - The target resource location
      Returns:
      The texture provider
    • playerSkinURL

      static TextureProvider playerSkinURL(String url, net.minecraft.resources.ResourceLocation target)
      Crates a URL texture provider
      Parameters:
      url - The URL of the texture
      target - The target resource location
      Returns:
      The texture provider
    • resource

      static TextureProvider resource(ResourceWithFallback target)
      Creates a resource texture provider
      Parameters:
      target - The target resource location
      Returns:
      The texture provider
    • resource

      static TextureProvider resource(net.minecraft.resources.ResourceLocation target)
      Creates a resource texture provider
      Parameters:
      target - The target resource location
      Returns:
      The texture provider
    • resource

      static TextureProvider resource(String target)
      Creates a resource texture provider
      Parameters:
      target - The target resource location
      Returns:
      The texture provider