Record Class Sprayed.Behavior<T extends Sprayed.SprayTarget>

java.lang.Object
java.lang.Record
dev.jaxydog.astral.content.item.custom.Sprayed.Behavior<T>
Type Parameters:
T - The expected target type.
Record Components:
predicate - A predicate that tests whether a given state is valid.
action - The action to execute if the state is valid.
charges - The charges to consume when the action is executed.
priority - The priority of the action's execution.
cancelling - Whether subsequent actions should be cancelled.
Enclosing interface:
Sprayed

public static record Sprayed.Behavior<T extends Sprayed.SprayTarget>(BiPredicate<Sprayed.Source,T extends Sprayed.SprayTarget> predicate, BiConsumer<Sprayed.Source,T extends Sprayed.SprayTarget> action, int charges, int priority, boolean cancelling) extends Record
Describes and implements a behavior when spraying an object.
Since:
2.0.0
  • Constructor Details

    • Behavior

      public Behavior(BiPredicate<Sprayed.Source,T> predicate, BiConsumer<Sprayed.Source,T> action, int charges, int priority)
      Describes and implements a behavior when spraying an object.
      Parameters:
      predicate - A predicate that tests whether a given state is valid.
      action - The action to execute if the state is valid.
      charges - The charges to consume when the action is executed.
      priority - The priority of the action's execution.
      Since:
      2.0.0
    • Behavior

      public Behavior(BiPredicate<Sprayed.Source,T> predicate, BiConsumer<Sprayed.Source,T> action, int charges)
      Describes and implements a behavior when spraying an object.
      Parameters:
      predicate - A predicate that tests whether a given state is valid.
      action - The action to execute if the state is valid.
      charges - The charges to consume when the action is executed.
      Since:
      2.0.0
    • Behavior

      public Behavior(BiPredicate<Sprayed.Source,T> predicate, BiConsumer<Sprayed.Source,T> action, int charges, int priority, boolean cancelling)
      Creates an instance of a Behavior record class.
      Parameters:
      predicate - the value for the predicate record component
      action - the value for the action record component
      charges - the value for the charges record component
      priority - the value for the priority record component
      cancelling - the value for the cancelling record component
  • Method Details

    • 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.
    • predicate

      public BiPredicate<Sprayed.Source,T> predicate()
      Returns the value of the predicate record component.
      Returns:
      the value of the predicate record component
    • action

      public BiConsumer<Sprayed.Source,T> action()
      Returns the value of the action record component.
      Returns:
      the value of the action record component
    • charges

      public int charges()
      Returns the value of the charges record component.
      Returns:
      the value of the charges record component
    • priority

      public int priority()
      Returns the value of the priority record component.
      Returns:
      the value of the priority record component
    • cancelling

      public boolean cancelling()
      Returns the value of the cancelling record component.
      Returns:
      the value of the cancelling record component