Class MotionControllerWalk

java.lang.Object
com.hypixel.hytale.server.npc.movement.controllers.MotionControllerBase
com.hypixel.hytale.server.npc.movement.controllers.MotionControllerWalk
All Implemented Interfaces:
com.hypixel.hytale.server.npc.movement.controllers.MotionController

public class MotionControllerWalk extends MotionControllerBase
  • Field Details

    • TYPE

      public static final String TYPE
      See Also:
    • CLIMB_FORWARD_DISTANCE

      public static final double CLIMB_FORWARD_DISTANCE
      See Also:
    • CLIMB_FORWARD_DISTANCE_SQUARED

      public static final double CLIMB_FORWARD_DISTANCE_SQUARED
      See Also:
    • JUMP_FORWARD_DISTANCE

      public static final double JUMP_FORWARD_DISTANCE
      See Also:
    • ONE_PLUS_THRESHOLD

      public static final double ONE_PLUS_THRESHOLD
      See Also:
    • DROP_MIN_STOP_DIST

      public static final double DROP_MIN_STOP_DIST
      See Also:
    • STATE_CAN_HOVER

      protected static final EnumSet<MotionKind> STATE_CAN_HOVER
    • VALID_MOTIONS

      protected static final EnumSet<MotionKind> VALID_MOTIONS
    • COLLISION_MATERIALS

      protected static final int COLLISION_MATERIALS
      See Also:
    • WALKING_MATERIALS

      protected static final int WALKING_MATERIALS
      See Also:
    • WALKING_MATERIALS_RELAXED

      protected static final int WALKING_MATERIALS_RELAXED
      See Also:
    • minHorizontalSpeed

      protected final double minHorizontalSpeed
    • maxVerticalSpeed

      protected final double maxVerticalSpeed
    • maxVerticalSpeedFluid

      protected final double maxVerticalSpeedFluid
    • acceleration

      protected final double acceleration
    • maxRotationSpeed

      protected final double maxRotationSpeed
    • maxMoveTurnAngle

      protected final float maxMoveTurnAngle
    • blendRestTurnAngle

      protected final float blendRestTurnAngle
    • blendRestRelativeSpeed

      protected final double blendRestRelativeSpeed
    • maxClimbHeight

      protected final double maxClimbHeight
    • jumpHeight

      protected final double jumpHeight
    • minJumpHeight

      protected final double minJumpHeight
    • minJumpDistance

      protected final double minJumpDistance
    • jumpForce

      protected final double jumpForce
    • jumpDescentSteepness

      protected final double jumpDescentSteepness
    • jumpBlending

      protected final double jumpBlending
    • jumpDescentBlending

      protected final double jumpDescentBlending
    • climbSpeedMult

      protected final double climbSpeedMult
    • climbSpeedPow

      protected final double climbSpeedPow
    • climbSpeedConst

      protected final double climbSpeedConst
    • maxDropHeight

      protected final double maxDropHeight
    • minDescentAnimationHeight

      protected final double minDescentAnimationHeight
    • descendFlatness

      protected final double descendFlatness
    • descendSpeedCompensation

      protected final double descendSpeedCompensation
    • descentSteepness

      protected final double descentSteepness
    • descentBlending

      protected final double descentBlending
    • descentAnimationType

      protected final MotionControllerWalk.DescentAnimationType descentAnimationType
    • ascentAnimationType

      protected final MotionControllerWalk.AscentAnimationType ascentAnimationType
    • maxWalkSpeedAfterHitMultiplier

      protected final double maxWalkSpeedAfterHitMultiplier
    • fenceBlockSet

      protected final int fenceBlockSet
    • minHover

      protected final double minHover
    • maxHover

      protected final double maxHover
    • hoverFreq

      protected final double hoverFreq
    • hoverCycle

      protected final float hoverCycle
    • minHoverClimb

      protected final double minHoverClimb
    • minHoverDrop

      protected final double minHoverDrop
    • floatsDown

      protected final boolean floatsDown
    • onGround

      protected boolean onGround
    • inWater

      protected boolean inWater
    • horizontalSpeedMultiplier

      protected double horizontalSpeedMultiplier
    • fallStartHeight

      protected double fallStartHeight
    • fallSpeed

      protected double fallSpeed
    • currentRelativeSpeed

      protected double currentRelativeSpeed
    • isFullyRotated

      protected boolean isFullyRotated
    • belowBlockType

      @Nullable protected com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType belowBlockType
    • belowBlockTypeId

      protected int belowBlockTypeId
    • footingBlocks

      protected int[] footingBlocks
    • footingFillers

      protected short[] footingFillers
    • footingRotations

      protected byte[] footingRotations
    • footingPosition

      protected final Vector3d footingPosition
    • footingBlocksValid

      protected boolean footingBlocksValid
    • breathingDepth

      protected double breathingDepth
    • constraintDepth

      protected double constraintDepth
    • climbUpDistance

      protected double climbUpDistance
    • currentJumpHeight

      protected double currentJumpHeight
    • jumpDropHeight

      protected double jumpDropHeight
    • jumpBlockHeight

      protected double jumpBlockHeight
    • predictedFallHeight

      protected double predictedFallHeight
    • jumpDropDirection

      protected final Vector3d jumpDropDirection
    • climbUpDirection

      protected final Vector3d climbUpDirection
    • currentClimbForwardDistance

      protected double currentClimbForwardDistance
    • maxClimbForwardDistance

      protected double maxClimbForwardDistance
    • totalDropDistance

      protected double totalDropDistance
    • climbForwardDirection

      protected final Vector3d climbForwardDirection
    • climbSpeed

      protected double climbSpeed
    • jumping

      protected boolean jumping
    • verticalRange

      protected final com.hypixel.hytale.server.npc.movement.controllers.MotionController.VerticalRange verticalRange
    • tmpClimbPosition

      protected final Vector3d tmpClimbPosition
    • tmpClimbMovement

      protected final Vector3d tmpClimbMovement
    • tmpMovePosition

      protected final Vector3d tmpMovePosition
    • tmpResults

      protected final CollisionResult tmpResults
    • tmpClimbHeightResults

      protected final Vector2d tmpClimbHeightResults
  • Constructor Details

  • Method Details

    • getType

      @Nonnull public String getType()
    • spawned

      public void spawned()
    • getWanderVerticalMovementRatio

      public double getWanderVerticalMovementRatio()
    • getDesiredVerticalRange

      @Nonnull public com.hypixel.hytale.server.npc.movement.controllers.MotionController.VerticalRange getDesiredVerticalRange(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • adjustReadPosition

      protected void adjustReadPosition(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      adjustReadPosition in class MotionControllerBase
    • adjustWritePosition

      protected void adjustWritePosition(Ref<EntityStore> ref, double dt, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      adjustWritePosition in class MotionControllerBase
    • updateAscendingStates

      protected void updateAscendingStates(@Nonnull Ref<EntityStore> ref, @Nonnull MovementStates movementStates, boolean fastMotionKind, boolean horizontalIdleKind, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      updateAscendingStates in class MotionControllerBase
    • updateDescendingStates

      protected void updateDescendingStates(@Nonnull Ref<EntityStore> ref, @Nonnull MovementStates movementStates, boolean fastMotionKind, boolean hovering, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      updateDescendingStates in class MotionControllerBase
    • isFastMotionKind

      public boolean isFastMotionKind(double speed)
      Specified by:
      isFastMotionKind in class MotionControllerBase
    • isInProgress

      public boolean isInProgress()
      Specified by:
      isInProgress in interface com.hypixel.hytale.server.npc.movement.controllers.MotionController
      Overrides:
      isInProgress in class MotionControllerBase
    • canAct

      public boolean canAct(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Specified by:
      canAct in interface com.hypixel.hytale.server.npc.movement.controllers.MotionController
      Overrides:
      canAct in class MotionControllerBase
    • updateModelParameters

      public void updateModelParameters(Ref<EntityStore> ref, Model model, @Nonnull Box boundingBox, ComponentAccessor<EntityStore> componentAccessor)
      Specified by:
      updateModelParameters in interface com.hypixel.hytale.server.npc.movement.controllers.MotionController
      Overrides:
      updateModelParameters in class MotionControllerBase
    • constrainRotations

      public void constrainRotations(Role role, @Nonnull TransformComponent transform)
    • forceVelocity

      public void forceVelocity(@Nonnull Vector3d velocity, VelocityConfig velocityConfig, boolean ignoreDamping)
      Specified by:
      forceVelocity in interface com.hypixel.hytale.server.npc.movement.controllers.MotionController
      Overrides:
      forceVelocity in class MotionControllerBase
    • inAir

      public boolean inAir()
    • onGround

      public boolean onGround()
    • standingOnBlockOfType

      public boolean standingOnBlockOfType(int blockSet)
      Specified by:
      standingOnBlockOfType in interface com.hypixel.hytale.server.npc.movement.controllers.MotionController
      Overrides:
      standingOnBlockOfType in class MotionControllerBase
    • inWater

      public boolean inWater()
    • touchesWater

      public boolean touchesWater(boolean defaultValue, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      touchesWater in class MotionControllerBase
    • getCurrentSpeed

      public double getCurrentSpeed()
    • getCurrentTurnRadius

      public double getCurrentTurnRadius()
    • getMaxClimbAngle

      public float getMaxClimbAngle()
    • getMaxSinkAngle

      public float getMaxSinkAngle()
    • getMaximumSpeed

      public double getMaximumSpeed()
    • is2D

      public boolean is2D()
    • canRestAtPlace

      public boolean canRestAtPlace()
    • getDesiredAltitudeWeight

      public double getDesiredAltitudeWeight()
    • getHeightOverGround

      public double getHeightOverGround()
    • estimateVelocity

      public boolean estimateVelocity(@Nonnull Steering steering, @Nonnull Vector3d velocityOut)
    • setMotionKind

      public void setMotionKind(MotionKind motionKind)
      Overrides:
      setMotionKind in class MotionControllerBase
    • postReadPosition

      public void postReadPosition(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Overrides:
      postReadPosition in class MotionControllerBase
    • translateToAccessiblePosition

      public boolean translateToAccessiblePosition(@Nonnull Vector3d position, @Nullable Box boundingBox, double minYValue, double maxYValue, ComponentAccessor<EntityStore> componentAccessor)
      Specified by:
      translateToAccessiblePosition in interface com.hypixel.hytale.server.npc.movement.controllers.MotionController
      Overrides:
      translateToAccessiblePosition in class MotionControllerBase
    • translateToAccessiblePosition

      public int translateToAccessiblePosition(@Nonnull Vector3d position, double minYValue, double maxYValue, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • computeMove

      protected double computeMove(@Nonnull Ref<EntityStore> ref, @Nonnull Role role, @Nonnull Steering steering, double dt, @Nonnull Vector3d translation, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Specified by:
      computeMove in class MotionControllerBase
    • computeNewFallSpeed

      private double computeNewFallSpeed(double dt, double fallSpeed)
    • executeMove

      protected double executeMove(@Nonnull Ref<EntityStore> ref, @Nonnull Role role, double dt, @Nonnull Vector3d translation, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
      Specified by:
      executeMove in class MotionControllerBase
    • probeMove

      public double probeMove(@Nonnull Ref<EntityStore> ref, @Nonnull ProbeMoveData probeMoveData, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • postExecuteMove

      protected void postExecuteMove()
      Overrides:
      postExecuteMove in class MotionControllerBase
    • getCurrentMaxBodyRotationSpeed

      public double getCurrentMaxBodyRotationSpeed()
    • computeHeading

      protected float computeHeading(float desiredAngle, double relativeTurnSpeed, float heading, double dt, boolean updateFullyRotated, boolean stopIfTurnedTooFar)
    • initiateDescend

      protected boolean initiateDescend(@Nonnull Vector3d translation, boolean wasOnGround, String logName, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • updateMovementVector

      protected double updateMovementVector(@Nonnull Vector3d probePosition, @Nonnull Vector3d probeMovement, @Nonnull Vector3d targetPosition, @Nonnull Vector3d directionComponentSelector)
    • discardIgnorableSlideCollisions

      @Nullable private BlockCollisionData discardIgnorableSlideCollisions(@Nonnull CollisionResult collisionResult, @Nullable BlockCollisionData startCollision, boolean acknowledgeDamage)
    • getFirstCollision

      @Nullable private BlockCollisionData getFirstCollision(@Nonnull CollisionResult collisionResult, boolean acknowledgeDamage)
    • bisect

      private double bisect(@Nonnull Vector3d validPosition, @Nonnull Vector3d invalidPosition, @Nonnull Vector3d result, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • shortenSlide

      private double shortenSlide(@Nonnull Vector3d translation, double endSlide)
    • shortenMovement

      private double shortenMovement(@Nonnull Vector3d start, @Nonnull Vector3d end, @Nonnull Vector3d result)
    • shortenMovement

      private double shortenMovement(double triggerScale)
    • validateTranslation

      private void validateTranslation(@Nonnull Vector3d translation, String kind)
    • validateSpeeds

      private void validateSpeeds(@Nonnull Ref<EntityStore> ref, @Nonnull String kind, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • lockOrientation

      private void lockOrientation(@Nonnull Steering steering, @Nonnull Vector3d translation, float heading)
    • computeBlendHeading

      private float computeBlendHeading(float heading, float moveHeading, double dt, double speedEstimate, double relativeTurnSpeed)
    • computeBlendHeading

      private float computeBlendHeading(float heading, float moveHeading, double dt, double speedEstimate, float turnAngle, double relativeTurnSpeed)
    • computeBlendTurnAngle

      private float computeBlendTurnAngle(float heading, float moveHeading)
    • computeClimbMove

      private double computeClimbMove(@Nonnull Vector3d climbDirection, double climbDistance, double distance, @Nonnull Vector3d translation)
    • computeDescendDirection

      private void computeDescendDirection(@Nonnull Vector3d translation)
    • computeClimbSpeed

      private double computeClimbSpeed(double walkSpeed)
    • tryClimb

      private boolean tryClimb(@Nonnull Vector3d translation, boolean avoidingBlockDamage, boolean relaxMoveConstraints, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • computeClimbHeight

      private double computeClimbHeight(@Nonnull Vector3d position, @Nonnull Vector3d direction, double height, double forward, @Nullable Vector3d targetPosition, @Nonnull Vector2d results, boolean acknowledgeDamage, boolean relaxMoveConstraints, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • isDropBlocked

      private boolean isDropBlocked(@Nonnull Vector3d position, double maxDropHeight, boolean updatePosition, boolean acknowledgeDamage, boolean relaxedMoveConstraints, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • dropDistance

      private double dropDistance(@Nonnull Vector3d position, double maxTestDistance, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • findDropBlockCollision

      @Nullable private BlockCollisionData findDropBlockCollision(@Nonnull Vector3d position, double maxTestDistance, @Nonnull ComponentAccessor<EntityStore> componentAccessor)
    • isClimbable

      private boolean isClimbable(@Nonnull com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType blockType, @Nonnull Fluid fluid, boolean avoidDamageBlocks)
    • isValidWalkPosition

      private boolean isValidWalkPosition(@Nonnull Ref<ChunkStore> chunkRef, @Nonnull ComponentAccessor<ChunkStore> chunkStore, double x, double y, double z, boolean acknowledgeDamage, boolean relaxedMoveConstraints)
    • isValidWalkPosition

      private boolean isValidWalkPosition(@Nonnull ChunkStore chunkStore, double x, double y, double z, boolean acknowledgeDamage, boolean relaxedMoveConstraints)
    • maxMoveFactor

      private double maxMoveFactor(@Nonnull Vector3d position, @Nonnull Vector3d velocity, boolean acknowledgeDamage, @Nonnull ComponentAccessor<EntityStore> componentAccessor)