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
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<TextureProvider>
static final com.mojang.serialization.Codec<TextureProvider>
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addScreenButtons
(net.minecraft.client.gui.Font font, net.minecraft.client.gui.layouts.GridLayout.RowHelper rowHelper, Consumer<TextureProvider> updateHandler) com.mojang.serialization.Codec<? extends TextureProvider>
codec()
The codec for reading the texture providernet.minecraft.resources.ResourceLocation
The resource location of the texture that will be rendereddefault boolean
isNone()
If the texture represents no resource
Should default to falsestatic TextureProvider
playerSkinURL
(String url, net.minecraft.resources.ResourceLocation target) Crates a URL texture providerstatic TextureProvider
resource
(ResourceWithFallback target) Creates a resource texture providerstatic TextureProvider
Creates a resource texture providerstatic TextureProvider
resource
(net.minecraft.resources.ResourceLocation target) Creates a resource texture providerstatic TextureProvider
Crates a URL texture providerdefault 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
-
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
Crates a URL texture provider- Parameters:
url
- The URL of the texturetarget
- The target resource location- Returns:
- The texture provider
-
playerSkinURL
Crates a URL texture provider- Parameters:
url
- The URL of the texturetarget
- The target resource location- Returns:
- The texture provider
-
resource
Creates a resource texture provider- Parameters:
target
- The target resource location- Returns:
- The texture provider
-
resource
Creates a resource texture provider- Parameters:
target
- The target resource location- Returns:
- The texture provider
-
resource
Creates a resource texture provider- Parameters:
target
- The target resource location- Returns:
- The texture provider
-