The base class for all entities including Player.

Hierarchy

Constructors

  • Entity constructor.

    Parameters

    • world: default
    • server: Server

    Returns Entity

Properties

runtimeIdCount: bigint

Methods

  • Compare an instance of Vector3 with another.

    Returns

    true if they're equal otherwise false.

    Parameters

    • vector: Vector3

      The Vector3 to compare to

    Returns boolean

  • Deprecated

    Returns default

  • Deprecated

    Parameters

    • propertyId: number
    • flagId: bigint

    Returns boolean

  • Get the entity's formatted name.

    Returns

    The entity's formatted name (including prefix & suffix).

    Returns string

  • Deprecated

    Returns default

  • Get the entity's (potentially custom) name.

    Returns

    The entity's name without formatting (usually prefix & suffix).

    Returns string

  • Beta

    Get entities within radius of current entity.

    Returns

    The entities within the specified radius sorted

    Parameters

    • radius: number

      number

    Returns Promise<Entity[]>

  • Beta

    Returns the nearest entity from the current entity.

    Remarks

    TODO: Customizable radius

    Parameters

    • Optional entities: Entity[]

      optional, the entities to compare the distance between

    Returns Entity[]

  • Get the entity's position.

    Returns

    The entity's position

    Returns Vector3

  • Get the entity's runtime id.

    Returns bigint

  • Returns Server

  • Get entity type.

    Returns

    The entity's namespace ID.

    Returns string

  • Returns default

  • Get the x coordinate.

    Returns

    The x coordinate's value

    Returns number

  • Get the y coordinate.

    Returns

    The y coordinate's value

    Returns number

  • Get the z coordinate.

    Returns

    The z coordinate's value

    Returns number

  • Check if the entity is a console instance.

    Returns

    true if the entity is console-controlled otherwise false

    Returns boolean

  • Check if the entity is a player.

    Returns

    true if the entity is client-controlled otherwise false

    Returns boolean

  • Serialize this Vector3 instance into a BinaryStream.

    Parameters

    • stream: default

      The network stream.

    Returns void

  • Fired when an entity collides with another entity.

    Parameters

    • entity: Entity

      the entity collided with

    Returns Promise<void>

  • Despawn the entity.

    Parameters

    • Optional player: Player

      optional - if specified, only send the packet to that player

    Returns Promise<void>

  • Send a message to an entity.

    Remarks

    This will silently fail on non-client-controlled entities.

    Example

    Send "Hello World!" to a client:

    entity.sendMessage('Hello World!');
    

    Parameters

    • message: string

      The message

    • Optional type: TextType

      The text type

    Returns void

  • Send the position to all the players in the same world.

    Returns Promise<void>

  • Beta

    Spawn the entity.

    Remarks

    motion, pitch & yaw is unimplemented.

    Parameters

    • Optional player: Player

      optional - if specified, only send the packet to that player

    Returns Promise<void>

  • Deprecated

    Parameters

    • propertyId: number
    • flagId: number
    • Optional value: boolean
    • Optional propertyType: FlagType

    Returns void

  • Deprecated

    Parameters

    • flagId: number
    • Optional value: boolean

    Returns void

  • Parameters

    • name: string

    Returns void

  • Set entity's position and notify the clients.

    Parameters

    Returns Promise<void>

  • Parameters

    • world: default

    Returns Promise<void>

  • Set the x position.

    Parameters

    • x: number

      The x coordinate

    • Optional suppress: boolean

      If true the client won't be notified about the position change

    Returns Promise<void>

  • Set the y position.

    Parameters

    • y: number

      The y coordinate

    • Optional suppress: boolean

      If true the client won't be notified about the position change

    Returns Promise<void>

  • Set the z position.

    Parameters

    • z: number

      The z coordinate

    • Optional suppress: boolean

      If true the client won't be notified about the position change

    Returns Promise<void>

  • Fired every tick from the event subscription in the constructor.

    Parameters

    • _tick: number

      current tick

    Returns Promise<void>

  • Deserialize a Vector3 from a BinaryStream.

    Parameters

    • stream: default

      The network stream.

    Returns Vector3

Generated using TypeDoc