Record Class EnchantContext
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.menu.enchant.model.EnchantContext
- Record Components:
slotIndex- The specific index order of this context in the generated list. Determines determinism for texture variation and tracking.applied- The existing enchantment instance currently present on the target item, if any.pending- The proposed or incoming enchantment instance and its origin source.xpRequirement- The total enchanting power (e.g., bookshelf count) needed to unlock this option.lapisCost- The amount of Lapis Lazuli consumed upon executing this action.xpCost- The amount of experience levels consumed upon executing this action.
public record EnchantContext(int slotIndex, Optional<net.minecraft.world.item.enchantment.EnchantmentInstance> applied, PendingEnchantment pending, int xpRequirement, int lapisCost, int xpCost)
extends Record
An immutable data record representing the logical back-end state of a single
generated enchantment option within the Enchanting Altar.
This context object holds the raw functional data (costs, requirements, instances) before it is processed into a visual render state for the UI.
-
Constructor Summary
ConstructorsConstructorDescriptionEnchantContext(int slotIndex, Optional<net.minecraft.world.item.enchantment.EnchantmentInstance> applied, PendingEnchantment pending, int xpRequirement, int lapisCost, int xpCost) Creates an instance of aEnchantContextrecord class. -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.world.item.enchantment.EnchantmentInstance> applied()Returns the value of theappliedrecord 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.pending()Returns the value of thependingrecord component.intReturns the value of theslotIndexrecord component.toString()Returns a string representation of this context, unwrapping the inner optionals for easier debugging and logging.intxpCost()Returns the value of thexpCostrecord component.intReturns the value of thexpRequirementrecord component.
-
Constructor Details
-
Method Details
-
toString
Returns a string representation of this context, unwrapping the inner optionals for easier debugging and logging. -
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 '=='. -
slotIndex
public int slotIndex()Returns the value of theslotIndexrecord component.- Returns:
- the value of the
slotIndexrecord component
-
applied
Returns the value of theappliedrecord component.- Returns:
- the value of the
appliedrecord component
-
pending
Returns the value of thependingrecord component.- Returns:
- the value of the
pendingrecord component
-
xpRequirement
public int xpRequirement()Returns the value of thexpRequirementrecord component.- Returns:
- the value of the
xpRequirementrecord component
-
lapisCost
public int lapisCost()Returns the value of thelapisCostrecord component.- Returns:
- the value of the
lapisCostrecord component
-
xpCost
public int xpCost()Returns the value of thexpCostrecord component.- Returns:
- the value of the
xpCostrecord component
-