Package me.gamercoder215.mobchip.ai.goal
Class PathfinderMoveToBlock
java.lang.Object
me.gamercoder215.mobchip.ai.goal.Pathfinder
me.gamercoder215.mobchip.ai.goal.PathfinderMoveToBlock
- All Implemented Interfaces:
PathfinderInfo
,Ranged
,SpeedModifier
Represents a Pathfinder for an Entity to move to another block
-
Nested Class Summary
Nested classes/interfaces inherited from class me.gamercoder215.mobchip.ai.goal.Pathfinder
Pathfinder.PathfinderFlag
-
Field Summary
FieldsFields inherited from class me.gamercoder215.mobchip.ai.goal.Pathfinder
entity
Fields inherited from interface me.gamercoder215.mobchip.ai.goal.Ranged
DEFAULT_ATTACK_INTERVAL, DEFAULT_ATTACK_RANGE, DEFAULT_LOOK_RANGE
Fields inherited from interface me.gamercoder215.mobchip.ai.SpeedModifier
DEFAULT_SPEED_MODIFIER
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a PathfinderMoveToBlock with the default Valid Block Predicate.Constructs a PathfinderMoveToBlock with the Default Speed Modifier.PathfinderMoveToBlock
(@NotNull Creature c, @Nullable Predicate<Location> validBlock, double speedMod) Constructs a PathfinderMoveToBlock with theDEFAULT_RANGE
;PathfinderMoveToBlock
(@NotNull Creature c, @Nullable Predicate<Location> validBlock, double speedMod, int range) Constructs a PathfinderMoveToBlock with horizontal and vertical ranges identical.PathfinderMoveToBlock
(@NotNull Creature c, @Nullable Predicate<Location> validBlock, double speedMod, int range, int vrange) Constructs a PathfinderMoveToBlock. -
Method Summary
Modifier and TypeMethodDescriptiongetFlags()
Fetches an Array of Flags that this Pathfinder has.Returns the NMS Internal Name.float
getRange()
Gets the current Range.double
Get the Speed Modifier of this Pathfinder.Fetches the function called when checking if this block is valid, or a default of true if not set.float
Fetches the current vertical range of this Pathfinder.void
setRange
(float range) Sets the current Range.void
setSpeedModifier
(double mod) Sets the Speed Modifier of this Pathfinder.void
setValidBlock
(@Nullable Predicate<Location> valid) Sets the function called when checking if this block is valid, can be nullvoid
setVerticalRange
(int vrange) Sets the vertical range of this Pathfinder.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
-
Field Details
-
DEFAULT_RANGE
public static final int DEFAULT_RANGEDefault Range to find Block (25)- See Also:
-
-
Constructor Details
-
PathfinderMoveToBlock
Constructs a PathfinderMoveToBlock with the default Valid Block Predicate.- Parameters:
c
- Creature to use
-
PathfinderMoveToBlock
public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock) Constructs a PathfinderMoveToBlock with the Default Speed Modifier.- Parameters:
c
- Creature to usevalidBlock
- Function to check if the location is valid
-
PathfinderMoveToBlock
public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock, double speedMod) Constructs a PathfinderMoveToBlock with theDEFAULT_RANGE
;- Parameters:
c
- Creature to usevalidBlock
- Function to check if the location is validspeedMod
- Speed Modifier while moving
-
PathfinderMoveToBlock
public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock, double speedMod, int range) Constructs a PathfinderMoveToBlock with horizontal and vertical ranges identical.- Parameters:
c
- Creature to usevalidBlock
- Function to check if the location is validspeedMod
- Speed Modifier while movingrange
- Range of blocks to look
-
PathfinderMoveToBlock
public PathfinderMoveToBlock(@NotNull @NotNull Creature c, @Nullable @Nullable Predicate<Location> validBlock, double speedMod, int range, int vrange) Constructs a PathfinderMoveToBlock.- Parameters:
c
- Creature to usevalidBlock
- Function to check if the location is validspeedMod
- Speed Modifier while movingrange
- Range of blocks to lookvrange
- Vertical range of blocks to look
-
-
Method Details
-
getRange
public float getRange()Description copied from interface:Ranged
Gets the current Range. -
getVerticalRange
public float getVerticalRange()Fetches the current vertical range of this Pathfinder.- Returns:
- Vertical Range
-
setVerticalRange
public void setVerticalRange(int vrange) Sets the vertical range of this Pathfinder.- Parameters:
vrange
- Vertical Range
-
setRange
Description copied from interface:Ranged
Sets the current Range.- Specified by:
setRange
in interfaceRanged
- Parameters:
range
- Range to set- Throws:
IllegalArgumentException
- if range is not an integer
-
getSpeedModifier
public double getSpeedModifier()Description copied from interface:SpeedModifier
Get the Speed Modifier of this Pathfinder.- Specified by:
getSpeedModifier
in interfaceSpeedModifier
- Returns:
- Speed Modifier
-
setSpeedModifier
public void setSpeedModifier(double mod) Description copied from interface:SpeedModifier
Sets the Speed Modifier of this Pathfinder.- Specified by:
setSpeedModifier
in interfaceSpeedModifier
- Parameters:
mod
- Modifier to set
-
getValidBlock
Fetches the function called when checking if this block is valid, or a default of true if not set.- Returns:
- Function called when checking if block is valid
-
setValidBlock
Sets the function called when checking if this block is valid, can be null- Parameters:
valid
- Function called when checking if block is valid
-
getFlags
Description copied from class:Pathfinder
Fetches an Array of Flags that this Pathfinder has.
- Specified by:
getFlags
in classPathfinder
- Returns:
- Array of Pathfinder Flags
-
getInternalName
Description copied from interface:PathfinderInfo
Returns the NMS Internal Name.- Specified by:
getInternalName
in interfacePathfinderInfo
- Returns:
- Internal Name
-