Package net.citizensnpcs.api.ai.tree
Class Precondition
java.lang.Object
net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
net.citizensnpcs.api.ai.tree.Precondition
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Precondition
runPrecondition
(Supplier<Boolean> condition) Creates aPrecondition
that returns eitherBehaviorStatus.SUCCESS
orBehaviorStatus.FAILURE
depending on the underlying condition's return status.static Precondition
wrappingPrecondition
(Behavior wrapping, Supplier<Boolean> condition) Methods inherited from class net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
create, run, shouldExecute
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.citizensnpcs.api.ai.tree.Behavior
reset, run, shouldExecute
-
Field Details
-
condition
-
-
Constructor Details
-
Precondition
-
-
Method Details
-
runPrecondition
Creates aPrecondition
that returns eitherBehaviorStatus.SUCCESS
orBehaviorStatus.FAILURE
depending on the underlying condition's return status.- Parameters:
condition
- The condition to check while executing- Returns:
- The precondition behavior
-
wrappingPrecondition
Creates aPrecondition
that wraps theshouldExecute
method inBehavior
. WhenshouldExecute
is called, the given condition will be checked before the wrapped behavior's method is called.- Parameters:
wrapping
- The behavior to wrap calls tocondition
- The execution condition- Returns:
- The precondition behavior
-