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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<TextureProvider>static final com.mojang.serialization.Codec<TextureProvider> -
Method Summary
Modifier and TypeMethodDescriptionvoidaddScreenButtons(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.ResourceLocationThe resource location of the texture that will be rendereddefault booleanisNone()If the texture represents no resource
Should default to falsestatic TextureProviderplayerSkinURL(String url, net.minecraft.resources.ResourceLocation target) Crates a URL texture providerstatic TextureProviderresource(ResourceWithFallback target) Creates a resource texture providerstatic TextureProviderCreates a resource texture providerstatic TextureProviderresource(net.minecraft.resources.ResourceLocation target) Creates a resource texture providerstatic TextureProviderCrates a URL texture providerdefault booleanIf 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
-