Record Class AnvilCombinationLogic.CombinationResult
java.lang.Object
java.lang.Record
io.artificial.enchantments.internal.anvil.AnvilCombinationLogic.CombinationResult
- Record Components:
result- the resulting item stack, or null if too expensive or no changecost- the total anvil cost in experience levelsnewPriorWork- the new prior work penalty for the result itemtooExpensive- whether the combination exceeds the maximum allowed costappliedEnchantments- map of enchantments applied to the resultconflicts- set of enchantments that conflicted and were not applied
- Enclosing class:
AnvilCombinationLogic
public static record AnvilCombinationLogic.CombinationResult(@Nullable org.bukkit.inventory.ItemStack result, int cost, int newPriorWork, boolean tooExpensive, Map<EnchantmentDefinition,Integer> appliedEnchantments, Set<EnchantmentDefinition> conflicts)
extends Record
Result of an anvil combination operation.
-
Constructor Summary
ConstructorsConstructorDescriptionCombinationResult(@Nullable org.bukkit.inventory.ItemStack result, int cost, int newPriorWork, boolean tooExpensive, Map<EnchantmentDefinition, Integer> appliedEnchantments, Set<EnchantmentDefinition> conflicts) Creates an instance of aCombinationResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theappliedEnchantmentsrecord component.Returns the value of theconflictsrecord component.intcost()Returns the value of thecostrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns whether the combination was successful.intReturns the value of thenewPriorWorkrecord component.@Nullable org.bukkit.inventory.ItemStackresult()Returns the value of theresultrecord component.booleanReturns the value of thetooExpensiverecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CombinationResult
public CombinationResult(@Nullable @Nullable org.bukkit.inventory.ItemStack result, int cost, int newPriorWork, boolean tooExpensive, Map<EnchantmentDefinition, Integer> appliedEnchantments, Set<EnchantmentDefinition> conflicts) Creates an instance of aCombinationResultrecord class.- Parameters:
result- the value for theresultrecord componentcost- the value for thecostrecord componentnewPriorWork- the value for thenewPriorWorkrecord componenttooExpensive- the value for thetooExpensiverecord componentappliedEnchantments- the value for theappliedEnchantmentsrecord componentconflicts- the value for theconflictsrecord component
-
-
Method Details
-
isSuccess
public boolean isSuccess()Returns whether the combination was successful.- Returns:
- true if a result item was produced and the cost was acceptable
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
result
@Nullable public @Nullable org.bukkit.inventory.ItemStack result()Returns the value of theresultrecord component.- Returns:
- the value of the
resultrecord component
-
cost
public int cost()Returns the value of thecostrecord component.- Returns:
- the value of the
costrecord component
-
newPriorWork
public int newPriorWork()Returns the value of thenewPriorWorkrecord component.- Returns:
- the value of the
newPriorWorkrecord component
-
tooExpensive
public boolean tooExpensive()Returns the value of thetooExpensiverecord component.- Returns:
- the value of the
tooExpensiverecord component
-
appliedEnchantments
Returns the value of theappliedEnchantmentsrecord component.- Returns:
- the value of the
appliedEnchantmentsrecord component
-
conflicts
Returns the value of theconflictsrecord component.- Returns:
- the value of the
conflictsrecord component
-