Class Movement
java.lang.Object
com.zenith.feature.pathfinder.movement.Movement
- All Implemented Interfaces:
IMovement
- Direct Known Subclasses:
MovementAscend,MovementDescend,MovementDiagonal,MovementDownward,MovementFall,MovementParkour,MovementPillar,MovementTraverse
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final PlayerContextprotected final BlockPosstatic final Direction[]protected final BlockPos[]The positions that need to be broken before this movement can ensueprotected final BlockPosThe position where we need to place a block before this movement can ensueprotected final BlockPos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract doublecalculateCost(CalculationContext context) booleanvoiddoublegetCost()doublegetCost(CalculationContext context) getDest()getSrc()voidoverride(double cost) protected booleanprotected booleanprepared(MovementState state) doublerecalculateCost(CalculationContext context) voidreset()Resets the current state status toMovementStatus.PREPPINGvoidResets the cache for special break, place, and walk into blocksbooleanprotected booleansafeToCancel(MovementState currentState) toBreak()toPlace()toString()update()Handles the execution of the latest Movement State, and offers a Status to the calling class.updateState(MovementState state) Calculate latest movement state.
-
Field Details
-
HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP
-
src
-
dest
-
positionsToBreak
The positions that need to be broken before this movement can ensue -
positionToPlace
The position where we need to place a block before this movement can ensue -
toWalkIntoCached
-
toBreakCached
-
toPlaceCached
-
ctx
-
-
Constructor Details
-
Movement
-
Movement
-
-
Method Details
-
calculateCost
-
calculateValidPositions
-
getCost
- Specified by:
getCostin interfaceIMovement- Throws:
NullPointerException
-
getCost
-
recalculateCost
-
override
public void override(double cost) -
update
Handles the execution of the latest Movement State, and offers a Status to the calling class. -
prepared
-
getSrc
-
getDest
-
reset
public void reset()Description copied from interface:IMovementResets the current state status toMovementStatus.PREPPING -
updateState
Calculate latest movement state. Gets called once a tick.- Parameters:
state- The current state- Returns:
- The new state
-
safeToCancel
public boolean safeToCancel()- Specified by:
safeToCancelin interfaceIMovement- Returns:
- Whether or not it is safe to cancel the current movement state
-
safeToCancel
-
checkLoadedChunk
public void checkLoadedChunk() -
calculatedWhileLoaded
public boolean calculatedWhileLoaded()- Specified by:
calculatedWhileLoadedin interfaceIMovement
-
resetBlockCache
public void resetBlockCache()Description copied from interface:IMovementResets the cache for special break, place, and walk into blocks- Specified by:
resetBlockCachein interfaceIMovement
-
getDirection
- Specified by:
getDirectionin interfaceIMovement
-
getValidPositions
-
playerInValidPosition
protected boolean playerInValidPosition() -
toWalkInto
-
toBreak
-
toPlace
-
toString
-