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)
    Checks if the player can attack the passed entity.
    On the server, additional leniency is added to account for movement/lag.
    default boolean
    canInteractWith(BlockPos pos, double padding)
    Checks if the player can reach (right-click) a block.
    On the server, additional leniency is added to account for movement/lag.
    default boolean
    canInteractWith(Entity entity, double padding)
    Checks if the player can reach (right-click) the passed entity.
    On the server, additional leniency is added to account for movement/lag.
    default double
    The attack range is increased by 3 for creative players, unless it is currently zero, which disables attacks.
    default double
    The reach distance is increased by 0.5 for creative players, unless it is currently zero, which disables interactions.
    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()
    • getAttackRange

      default double getAttackRange()
      The attack range is increased by 3 for creative players, unless it is currently zero, which disables attacks.
      Returns:
      The attack range of this player.
    • getReachDistance

      default double getReachDistance()
      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.
    • canHit

      default boolean canHit(Entity entity, double padding)
      Checks if the player can attack the passed entity.
      On the server, additional leniency 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.
    • canInteractWith

      default boolean canInteractWith(Entity entity, double padding)
      Checks if the player can reach (right-click) the passed entity.
      On the server, additional leniency is added to account for movement/lag.
      Parameters:
      entity - The entity being range-checked.
      padding - Extra validation distance.
      Returns:
      If the player can interact with the passed entity.
    • isCloseEnough

      default boolean isCloseEnough(Entity entity, double dist)
      Utility check to see if the player is close enough to a target entity.
      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.
    • canInteractWith

      default boolean canInteractWith(BlockPos pos, double padding)
      Checks if the player can reach (right-click) a block.
      On the server, additional leniency 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.