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 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.MapCodec<? extends TextureProvider> codec()
      The codec for reading the texture provider
      Returns:
      The codec
    • type

    • 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