Record Class EnchantRenderState
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.menu.enchant.model.EnchantRenderState
- Record Components:
visualSource- The origin classification (Target, Source, Table) dictating the widget's texture and color palette.enchantment- The target enchantment to be displayed.displayLevel- The specific level integer to format and display in the UI (e.g., "II" or "V").xpRequirement- The enchanting power required to display the slot as active.xpCost- The experience cost to execute the action, determining the level sprite shown.lapisCost- The lapis cost to execute the action.state- The structural interactivity state of the widget (e.g., AVAILABLE, MAXED, LOCKED).
public record EnchantRenderState(EnchantmentSource visualSource, Optional<net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment>> enchantment, int displayLevel, int xpRequirement, int xpCost, int lapisCost, EnchantState state)
extends Record
An immutable data record representing the evaluated visual front-end state
of an enchantment slot widget.
This object decouples the pure logic representation (EnchantContext)
from the GUI elements, pre-calculating the exact display text levels, textures,
and interactivity statuses needed by the widgets.
-
Constructor Summary
ConstructorsConstructorDescriptionEnchantRenderState(EnchantmentSource visualSource, Optional<net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment>> enchantment, int displayLevel, int xpRequirement, int xpCost, int lapisCost, EnchantState state) Creates an instance of aEnchantRenderStaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thedisplayLevelrecord component.Optional<net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment>> Returns the value of theenchantmentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thelapisCostrecord component.state()Returns the value of thestaterecord component.toString()Returns a string representation of this render state, formatting the inner holders for easier debugging and layout tracking.Returns the value of thevisualSourcerecord component.intxpCost()Returns the value of thexpCostrecord component.intReturns the value of thexpRequirementrecord component.
-
Constructor Details
-
Method Details
-
toString
Returns a string representation of this render state, formatting the inner holders for easier debugging and layout tracking. -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
visualSource
Returns the value of thevisualSourcerecord component.- Returns:
- the value of the
visualSourcerecord component
-
enchantment
public Optional<net.minecraft.core.Holder<net.minecraft.world.item.enchantment.Enchantment>> enchantment()Returns the value of theenchantmentrecord component.- Returns:
- the value of the
enchantmentrecord component
-
displayLevel
public int displayLevel()Returns the value of thedisplayLevelrecord component.- Returns:
- the value of the
displayLevelrecord component
-
xpRequirement
public int xpRequirement()Returns the value of thexpRequirementrecord component.- Returns:
- the value of the
xpRequirementrecord component
-
xpCost
public int xpCost()Returns the value of thexpCostrecord component.- Returns:
- the value of the
xpCostrecord component
-
lapisCost
public int lapisCost()Returns the value of thelapisCostrecord component.- Returns:
- the value of the
lapisCostrecord component
-
state
Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-