Record Class FallbackTextureProvider
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.texture.type.FallbackTextureProvider
- Record Components:
resource
- the resource
- All Implemented Interfaces:
TextureProvider
public record FallbackTextureProvider(ResourceWithFallback resource)
extends Record
implements TextureProvider
The fallback texture provider simply takes an
ResourceWithFallback
and renders the image at the
target locataion depending on if the target location has an image
or not-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<FallbackTextureProvider>
Fields inherited from interface com.pixelmonmod.pixelmon.api.texture.TextureProvider
DIRECT_CODEC
-
Constructor Summary
ConstructorDescriptionFallbackTextureProvider
(ResourceWithFallback resource) Creates an instance of aFallbackTextureProvider
record class. -
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 providerfinal boolean
Indicates whether some other object is "equal to" this one.net.minecraft.resources.ResourceLocation
The resource location of the texture that will be renderedfinal int
hashCode()
Returns a hash code value for this object.boolean
isNone()
If the texture represents no resource
Should default to falseresource()
Returns the value of theresource
record component.final String
toString()
Returns a string representation of this record class.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
-
CODEC
-
-
Constructor Details
-
FallbackTextureProvider
Creates an instance of aFallbackTextureProvider
record class.- Parameters:
resource
- the value for theresource
record component
-
-
Method Details
-
codec
Description copied from interface:TextureProvider
The codec for reading the texture provider- Specified by:
codec
in interfaceTextureProvider
- Returns:
- The codec
-
addScreenButtons
public void addScreenButtons(net.minecraft.client.gui.Font font, net.minecraft.client.gui.layouts.GridLayout.RowHelper rowHelper, Consumer<TextureProvider> updateHandler) - Specified by:
addScreenButtons
in interfaceTextureProvider
-
getTexture
public net.minecraft.resources.ResourceLocation getTexture()Description copied from interface:TextureProvider
The resource location of the texture that will be rendered- Specified by:
getTexture
in interfaceTextureProvider
- Returns:
- The resource location
-
usingFallback
public boolean usingFallback()Description copied from interface:TextureProvider
If the texture being used is a default resource because the real resource could not be found in the files
Should default to false- Specified by:
usingFallback
in interfaceTextureProvider
- Returns:
- Returns true when unable to locate the required resource
-
isNone
public boolean isNone()Description copied from interface:TextureProvider
If the texture represents no resource
Should default to false- Specified by:
isNone
in interfaceTextureProvider
- Returns:
- Returns true when equal to "texture/none"
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
resource
Returns the value of theresource
record component.- Returns:
- the value of the
resource
record component
-