Package me.gamercoder215.mobchip.ai.goal
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 me.gamercoder215.mobchip.ai.goal.Pathfinder
Pathfinder.PathfinderFlag
-
Field Summary
Fields inherited from class me.gamercoder215.mobchip.ai.goal.Pathfinder
entity
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Constructs a CustomPathfinder. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether this Pathfinder Goal will continue to be used.boolean
Whether this Pathfinder Goal can be interrupted.abstract boolean
canStart()
Whether this Custom Pathfinder can start.abstract @NotNull Pathfinder.PathfinderFlag[]
getFlags()
The flags of this Custom Pathfinder.Deprecated.Internal Use onlyabstract void
start()
Called on the first tick this Pathfinder starts, whencanStart()
returns true.void
stop()
Called when this Pathfinder stops being used.abstract void
tick()
Methods inherited from class me.gamercoder215.mobchip.ai.goal.Pathfinder
getEntity
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.gamercoder215.mobchip.ai.goal.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:
getFlags
in 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:PathfinderInfo
Returns the NMS Internal Name.- Returns:
- Internal Name
-