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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Precondition
runPrecondition
(Condition condition) Creates aPrecondition
that returns eitherBehaviorStatus.SUCCESS
orBehaviorStatus.FAILURE
depending on the underlyingCondition
's return status.static Precondition
wrappingPrecondition
(Behavior wrapping, Condition 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 underlyingCondition
'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 givenCondition
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
-