Class EntityPhysical

All Implemented Interfaces:
EntityAgeable, EntityAsyncPrepare, EntityDamageable, EntityNameable, Metadatable, Cloneable
Direct Known Subclasses:
EntityIntelligent

@PowerNukkitXOnly @Since("1.6.0.0-PNX") public abstract class EntityPhysical extends EntityCreature implements EntityAsyncPrepare
  • Field Details

    • PRECISION

      public static final float PRECISION
      移动精度阈值,绝对值小于此阈值的移动被视为没有移动
      See Also:
    • globalCycleTickSpread

      public static final AtomicInteger globalCycleTickSpread
    • tickSpread

      public final int tickSpread
      时间泛播延迟,用于缓解在同一时间大量提交任务挤占cpu的情况
    • offsetBoundingBox

      protected final AxisAlignedBB offsetBoundingBox
      提供实时最新碰撞箱位置
    • previousCollideMotion

      protected final Vector3 previousCollideMotion
    • previousCurrentMotion

      protected final Vector3 previousCurrentMotion
    • fallingTick

      protected int fallingTick
      实体自由落体运动的时间
    • needsRecalcMovement

      protected boolean needsRecalcMovement
  • Constructor Details

  • Method Details

    • asyncPrepare

      public void asyncPrepare(int currentTick)
      Description copied from interface: EntityAsyncPrepare
      该方法将被并行执行,每一刻都执行一次,并保证每一次onUpdate之前都执行完毕
      Specified by:
      asyncPrepare in interface EntityAsyncPrepare
      Parameters:
      currentTick - 当前游戏刻
    • onUpdate

      public boolean onUpdate(int currentTick)
      Overrides:
      onUpdate in class Entity
    • canBeMovedByCurrents

      public boolean canBeMovedByCurrents()
      Description copied from class: Entity
      Returns whether this entity can be moved by currents in liquids.
      Overrides:
      canBeMovedByCurrents in class Entity
      Returns:
      boolean
    • updateMovement

      public void updateMovement()
      Overrides:
      updateMovement in class Entity
    • addTmpMoveMotion

      public final void addTmpMoveMotion(Vector3 tmpMotion)
    • addTmpMoveMotionXZ

      public final void addTmpMoveMotionXZ(Vector3 tmpMotion)
    • handleGravity

      protected void handleGravity()
    • getMovementSpeedAtBlock

      public float getMovementSpeedAtBlock(Block block)
      获取实体在某方块处行走的真实速度,此方法会考虑流体阻力
      Parameters:
      block - 实体所在的方块,不是脚下的方块
      Returns:
      在某方块处行走的真实速度
    • handleFrictionMovement

      protected void handleFrictionMovement()
    • handleLiquidMovement

      protected void handleLiquidMovement()
      默认使用nk内置实现,这只是个后备算法
    • addPreviousLiquidMovement

      protected void addPreviousLiquidMovement()
    • hasWaterAt

      @PowerNukkitOnly @Since("1.6.0.0-PNX") protected boolean hasWaterAt(float height)
      Overrides:
      hasWaterAt in class Entity
    • handleFloatingMovement

      protected void handleFloatingMovement()
    • handleCollideMovement

      protected void handleCollideMovement(int currentTick)
    • onCollide

      protected boolean onCollide(int currentTick, List<Entity> collidingEntities)
      Parameters:
      collidingEntities - 碰撞的实体
      Returns:
      false以拦截实体碰撞运动计算
    • getLiquidMovementSpeed

      protected final float getLiquidMovementSpeed(BlockLiquid liquid)
    • getFootHeight

      public float getFootHeight()
    • calculateOffsetBoundingBox

      protected void calculateOffsetBoundingBox()
    • getOffsetBoundingBox

      public AxisAlignedBB getOffsetBoundingBox()
    • resetFallDistance

      public void resetFallDistance()
      Overrides:
      resetFallDistance in class Entity
    • getGravity

      public float getGravity()
      Overrides:
      getGravity in class EntityLiving
    • getFallingTick

      public int getFallingTick()