Class CustomPathfinder
java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.CustomPathfinder
- All Implemented Interfaces:
PathfinderInfo
Represents an extendable Pathfinder for creating Custom Pathfinders.
-
Nested Class Summary
Nested classes/interfaces inherited from class Pathfinder
Pathfinder.PathfinderFlag -
Field Summary
Fields inherited from class Pathfinder
entity -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomPathfinder(@NotNull Mob m) Constructs a CustomPathfinder. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether this Pathfinder Goal will continue to be used.booleanWhether this Pathfinder Goal can be interrupted.abstract booleancanStart()Whether this Custom Pathfinder can start.abstract @NotNull Pathfinder.PathfinderFlag[]getFlags()The flags of this Custom Pathfinder.Deprecated.Internal Use onlyabstract voidstart()Called on the first tick this Pathfinder starts, whencanStart()returns true.voidstop()Called when this Pathfinder stops being used.abstract voidtick()Methods inherited from class Pathfinder
getEntityMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PathfinderInfo
getName
-
Constructor Details
-
CustomPathfinder
Constructs a CustomPathfinder.- Parameters:
m- Mob to use
-
-
Method Details
-
getFlags
The flags of this Custom Pathfinder. Can be null for no flags.Example:
// public class LavaFloat extends CustomPathfinder { // This Pathfinder Goal will involve movement and jumping, so we have to add it as a flag getFlags() { return new PathfinderFlag[] { PathfinderFlag.MOVEMENT, PathfinderFlag.JUMPING; } }- Specified by:
getFlagsin classPathfinder- Returns:
- Flags
-
canStart
public abstract boolean canStart()Whether this Custom Pathfinder can start.
Any assignments to fields or checks should be in here. Return true forstart()to automatically run.
Example:// public class LavaFloat extends CustomPathfinder { import org.bukkit.Material; public boolean canStart() { return this.entity.getLocation().getBlock().getType() == Material.LAVA; }- Returns:
- true if Pathfinder can start, else false
-
start
public abstract void start()Called on the first tick this Pathfinder starts, whencanStart()returns true.
Any actions that this Pathfinder will call first should be in here. This method will run automatically.
Example:// public class LavaFloat extends CustomPathfinder { // Beginning Movements public void start() { // Get Entity Brain brain.getController().jump(); brain.getController().strafe(1F, 0F); } -
tick
public abstract void tick() -
stop
public void stop()Called when this Pathfinder stops being used.
Any actions that this Pathfinder will call when it stops should be in here. This method will run automatically. -
canInterrupt
public boolean canInterrupt()Whether this Pathfinder Goal can be interrupted. Default: true- Returns:
- true if Pathfinder can be interrupted, else false
-
canContinueToUse
public boolean canContinueToUse()Whether this Pathfinder Goal will continue to be used.Override this method if you have additional checks after the Pathfinder has started. By default, it will call
canStart().- Returns:
- true if Pathfinder can continue to use, else false
-
getInternalName
Deprecated.Internal Use onlyDescription copied from interface:PathfinderInfoReturns the pathfinder's internal name. This may match the actual NMS name of the pathfinder, but it may not.- Returns:
- Internal Name
-