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 PreconditionrunPrecondition(Supplier<Boolean> condition) Creates aPreconditionthat returns eitherBehaviorStatus.SUCCESSorBehaviorStatus.FAILUREdepending on the underlying condition's return status.static PreconditionwrappingPrecondition(Behavior wrapping, Supplier<Boolean> condition) Methods inherited from class net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
create, run, shouldExecuteMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.citizensnpcs.api.ai.tree.Behavior
reset, run, shouldExecute
-
Field Details
-
condition
-
-
Constructor Details
-
Precondition
-
-
Method Details
-
runPrecondition
Creates aPreconditionthat returns eitherBehaviorStatus.SUCCESSorBehaviorStatus.FAILUREdepending on the underlying condition's return status.- Parameters:
condition- The condition to check while executing- Returns:
- The precondition behavior
-
wrappingPrecondition
Creates aPreconditionthat wraps theshouldExecutemethod inBehavior. WhenshouldExecuteis 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
-