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 Summary
ConstructorsConstructorDescriptionBehavior(BiPredicate<Sprayed.Source, T> predicate, BiConsumer<Sprayed.Source, T> action, int charges) Describes and implements a behavior when spraying an object.Behavior(BiPredicate<Sprayed.Source, T> predicate, BiConsumer<Sprayed.Source, T> action, int charges, int priority) Describes and implements a behavior when spraying an object.Behavior(BiPredicate<Sprayed.Source, T> predicate, BiConsumer<Sprayed.Source, T> action, int charges, int priority, boolean cancelling) Creates an instance of aBehaviorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionaction()Returns the value of theactionrecord component.booleanReturns the value of thecancellingrecord component.intcharges()Returns the value of thechargesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thepredicaterecord component.intpriority()Returns the value of thepriorityrecord component.final StringtoString()Returns a string representation of this record class.
-
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 aBehaviorrecord class.- Parameters:
predicate- the value for thepredicaterecord componentaction- the value for theactionrecord componentcharges- the value for thechargesrecord componentpriority- the value for thepriorityrecord componentcancelling- the value for thecancellingrecord component
-
-
Method Details
-
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 '=='. -
predicate
Returns the value of thepredicaterecord component.- Returns:
- the value of the
predicaterecord component
-
action
Returns the value of theactionrecord component.- Returns:
- the value of the
actionrecord component
-
charges
public int charges()Returns the value of thechargesrecord component.- Returns:
- the value of the
chargesrecord component
-
priority
public int priority()Returns the value of thepriorityrecord component.- Returns:
- the value of the
priorityrecord component
-
cancelling
public boolean cancelling()Returns the value of thecancellingrecord component.- Returns:
- the value of the
cancellingrecord component
-