Package net.citizensnpcs.api.ai.goals
Class WanderGoal
java.lang.Object
net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
net.citizensnpcs.api.ai.goals.WanderGoal
-
Method Summary
Modifier and TypeMethodDescriptionstatic WanderGoal
createWithNPC
(NPC npc) static WanderGoal
createWithNPCAndRange
(NPC npc, int xrange, int yrange) static WanderGoal
createWithNPCAndRangeAndTree
(NPC npc, int xrange, int yrange, com.google.common.base.Supplier<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree) static WanderGoal
createWithNPCAndRangeAndTreeAndFallback
(NPC npc, int xrange, int yrange, com.google.common.base.Supplier<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree, com.google.common.base.Function<NPC, Location> fallback) static WanderGoal
createWithNPCAndRangeAndTreeAndFallbackAndRegion
(NPC npc, int xrange, int yrange, com.google.common.base.Supplier<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree, com.google.common.base.Function<NPC, Location> fallback, Object worldguardRegion) The full builder method.void
onFinish
(NavigationCompleteEvent event) void
pause()
void
reset()
Resets the goal and any resources or state it is holding.run()
Runs the behavior for one 'tick', optionally changing the state that it is in.void
setDelay
(int delay) void
setWorldGuardRegion
(Object region) void
setXYRange
(int xrange, int yrange) boolean
Returns whether the behavior is ready to run.void
unpause()
Methods inherited from class net.citizensnpcs.api.ai.tree.BehaviorGoalAdapter
create, run, shouldExecute
-
Method Details
-
pause
public void pause() -
reset
public void reset()Description copied from interface:Goal
Resets the goal and any resources or state it is holding. -
run
Description copied from interface:Behavior
Runs the behavior for one 'tick', optionally changing the state that it is in. -
setDelay
public void setDelay(int delay) -
setWorldGuardRegion
-
setXYRange
public void setXYRange(int xrange, int yrange) -
shouldExecute
public boolean shouldExecute()Description copied from interface:Behavior
Returns whether the behavior is ready to run. Note this is called once when deciding whether to start execution of a leaf node. The actual execution status is determined by the return value ofBehavior.run()
which is repeatedly called by the executing node.- Specified by:
shouldExecute
in interfaceBehavior
-
unpause
public void unpause() -
createWithNPC
-
createWithNPCAndRange
-
createWithNPCAndRangeAndTree
public static WanderGoal createWithNPCAndRangeAndTree(NPC npc, int xrange, int yrange, com.google.common.base.Supplier<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree) -
createWithNPCAndRangeAndTreeAndFallback
public static WanderGoal createWithNPCAndRangeAndTreeAndFallback(NPC npc, int xrange, int yrange, com.google.common.base.Supplier<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree, com.google.common.base.Function<NPC, Location> fallback) -
createWithNPCAndRangeAndTreeAndFallbackAndRegion
public static WanderGoal createWithNPCAndRangeAndTreeAndFallbackAndRegion(NPC npc, int xrange, int yrange, com.google.common.base.Supplier<ch.ethz.globis.phtree.PhTreeSolid<Boolean>> tree, com.google.common.base.Function<NPC, Location> fallback, Object worldguardRegion) The full builder method.- Parameters:
npc
- the NPC to wanderxrange
- x/z range, in blocksyrange
- y range, in blockstree
- an optionalPhTreeSolid
supplier to allow only wandering within a certainPhTreeSolid
fallback
- an optional fallback locationworldguardRegion
- the optional region- Returns:
- the built goal