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 change
cost - the total anvil cost in experience levels
newPriorWork - the new prior work penalty for the result item
tooExpensive - whether the combination exceeds the maximum allowed cost
appliedEnchantments - map of enchantments applied to the result
conflicts - 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 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 a CombinationResult record class.
      Parameters:
      result - the value for the result record component
      cost - the value for the cost record component
      newPriorWork - the value for the newPriorWork record component
      tooExpensive - the value for the tooExpensive record component
      appliedEnchantments - the value for the appliedEnchantments record component
      conflicts - the value for the conflicts record 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

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • result

      @Nullable public @Nullable org.bukkit.inventory.ItemStack result()
      Returns the value of the result record component.
      Returns:
      the value of the result record component
    • cost

      public int cost()
      Returns the value of the cost record component.
      Returns:
      the value of the cost record component
    • newPriorWork

      public int newPriorWork()
      Returns the value of the newPriorWork record component.
      Returns:
      the value of the newPriorWork record component
    • tooExpensive

      public boolean tooExpensive()
      Returns the value of the tooExpensive record component.
      Returns:
      the value of the tooExpensive record component
    • appliedEnchantments

      public Map<EnchantmentDefinition,Integer> appliedEnchantments()
      Returns the value of the appliedEnchantments record component.
      Returns:
      the value of the appliedEnchantments record component
    • conflicts

      public Set<EnchantmentDefinition> conflicts()
      Returns the value of the conflicts record component.
      Returns:
      the value of the conflicts record component