Interface IForgePlayer

All Known Implementing Classes:
AbstractClientPlayer, FakePlayer, LocalPlayer, Player, RemotePlayer, ServerPlayer

public interface IForgePlayer
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    canHit(Entity entity, double padding)
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    canInteractWith(BlockPos pos, double padding)
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    canInteractWith(Entity entity, double padding)
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    canReach(BlockPos pos, double padding)
    Checks if the player can reach a block.
    On the server, additional padding is added to account for movement/lag.
    default boolean
    canReach(Entity entity, double padding)
    Checks if the player can reach an entity.
    On the server, additional padding is added to account for movement/lag.
    default boolean
    canReach(Vec3 entityHitVec, double padding)
    Checks if the player can reach an entity by targeting the passed vector.
    On the server, additional padding is added to account for movement/lag.
    default double
    Deprecated, for removal: This API element is subject to removal in a future version.
    default double
    The reach distance is increased by 0.5 for creative players, unless it is currently zero, which disables interactions.
    default double
    The entity reach is increased by 3 for creative players, unless it is currently zero, which disables attacks and entity interactions.
    default double
    Deprecated, for removal: This API element is subject to removal in a future version.
    default boolean
    isCloseEnough(Entity entity, double dist)
    Utility check to see if the player is close enough to a target entity.
    private Player
     
  • Method Details

    • self

      private Player self()
    • getEntityReach

      default double getEntityReach()
      The entity reach is increased by 3 for creative players, unless it is currently zero, which disables attacks and entity interactions.
      Returns:
      The entity reach of this player.
    • getAttackRange

      @Deprecated(forRemoval=true, since="1.19.4") default double getAttackRange()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getBlockReach

      default double getBlockReach()
      The reach distance is increased by 0.5 for creative players, unless it is currently zero, which disables interactions.
      Returns:
      The reach distance of this player.
    • getReachDistance

      @Deprecated(forRemoval=true, since="1.19.4") default double getReachDistance()
      Deprecated, for removal: This API element is subject to removal in a future version.
    • canReach

      default boolean canReach(Vec3 entityHitVec, double padding)
      Checks if the player can reach an entity by targeting the passed vector.
      On the server, additional padding is added to account for movement/lag.
      Parameters:
      vec - The vector being range-checked.
      padding - Extra validation distance.
      Returns:
      If the player can attack the entity.
      API Note:
      Do not use for block checks, as this method uses getEntityReach()
    • canReach

      default boolean canReach(Entity entity, double padding)
      Checks if the player can reach an entity.
      On the server, additional padding is added to account for movement/lag.
      Parameters:
      entity - The entity being range-checked.
      padding - Extra validation distance.
      Returns:
      If the player can attack the passed entity.
      API Note:
      Prefer using canReach(Vec3, double) if you have a HitResult available.
    • canHit

      @Deprecated(forRemoval=true, since="1.19.4") default boolean canHit(Entity entity, double padding)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • canInteractWith

      @Deprecated(forRemoval=true, since="1.19.4") default boolean canInteractWith(Entity entity, double padding)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • canReach

      default boolean canReach(BlockPos pos, double padding)
      Checks if the player can reach a block.
      On the server, additional padding is added to account for movement/lag.
      Parameters:
      pos - The position being range-checked.
      padding - Extra validation distance.
      Returns:
      If the player can interact with this location.
    • canInteractWith

      @Deprecated(forRemoval=true, since="1.19.4") default boolean canInteractWith(BlockPos pos, double padding)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • isCloseEnough

      default boolean isCloseEnough(Entity entity, double dist)
      Utility check to see if the player is close enough to a target entity. Uses "eye-to-closest-corner" checks.
      Parameters:
      entity - The entity being checked against
      dist - The max distance allowed
      Returns:
      If the eye-to-center distance between this player and the passed entity is less than dist.
      Implementation Note:
      This method inflates the bounding box by the pick radius, which differs from vanilla. But vanilla doesn't use the pick radius, the only entity with > 0 is AbstractHurtingProjectile.