SerenityJS
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    attributes: EntityAttributes

    The attributes that are attached to the entity These values are derived from the components and traits of the entity

    dimension: Dimension

    The current dimension of the entity. This should not be dynamically changed, but instead use the teleport method.

    dynamicProperties: Map<string, JSONLikeValue> = ...

    The components that are attached to the entity

    The flags that are attached to the entity These values are derived from the components and traits of the entity

    identifier: EntityIdentifier

    The identifier of the entity.

    inputInfo: EntityInputInfo = ...

    The input info of the entity

    isAlive: boolean = false

    Whether the entity is alive or not.

    isFalling: boolean = false

    Whether the entity is falling or not.

    isMoving: boolean = false

    Whether the entity is moving or not.

    isTicking: boolean = true

    Whether the entity is currently ticking or not. If true, this means the behaviors of the entity are being processed. If false, this means the entity currently isn't within the simulation distance from a player.

    metadata: EntityActorMetadata

    The metadata that is attached to the entity These values are derived from the components and traits of the entity

    onGround: boolean = false

    Whether the entity is on the ground or not.

    runtimeId: bigint = ++Entity.runtimeId

    The current runtime id of the entity. (Incremented each time an entity is created)

    scoreboardIdentity: ScoreboardIdentity

    The scoreboard identity of the entity.

    serenity: Serenity

    The serenity instance of the server

    sharedProperties: EntitySharedProperties

    The shared properties that are attached to the entity. These properites are shared to the client to be used in resource pack elements. They can also be queried via the molang engine for use in resource packs.

    The storage of the entity. This is used to persist data about the entity between server restarts.

    traits: Map<string, EntityTrait> = ...

    The traits that are attached to the entity

    The type of the entity.

    velocity: Vector3f = ...

    The current velocity of the entity

    runtimeId: bigint = 0n

    The running total of entities that have been created

    Accessors

    Methods

    • Adds a storage entry to the entity.

      Type Parameters

      • T extends BaseTag

      Parameters

      • entry: T

        The storage entry to add.

      Returns void

    • Adds a trait to the entity.

      Type Parameters

      Parameters

      • trait: EntityTrait | T

        The trait to add to the entity.

      • Optionaloptions: ConstructorParameters<T>[1]

        The additional options to pass to the trait.

      Returns InstanceType<T>

      The trait instance that was added to the entity.

    • Forces the entity to drop an item from its inventory.

      Parameters

      • slot: number

        The slot to drop the item from.

      • amount: number

        The amount of items to drop.

      • container: Container

        The container to drop the item from.

      Returns boolean

      Whether or not the item was dropped.

    • Get the collision height of the entity.

      Returns number

      The collision height of the entity.

      This method depends on the EntityCollisionTrait trait.

    • Get the collision width of the entity.

      Returns number

      The collision width of the entity.

      This method depends on the EntityCollisionTrait trait.

    • Gets the gravity force of the entity.

      Returns number

      The gravity force of the entity.

      This method depends on the EntityGravityTrait trait.

    • Get a storage entry from the entity.

      Type Parameters

      • T extends BaseTag

      Parameters

      • name: string

        The name of the storage entry.

      Returns null | T

      The storage entry if it exists, otherwise null.

    • Computes the view direction vector based on the current pitch and yaw rotations.

      Returns Vector3f

      A Vector3f representing the direction the view is pointing.

    • Checks whether the entity has the effect or not.

      Parameters

      • effectType: EffectType

        The effect type to check if the entity has.

      Returns boolean

      whether the entity has the effect or not.

    • Checks if the entity has gravity.

      Returns boolean

      Whether or not the entity has gravity.

      This method depends on the EntityGravityTrait trait.

    • Check if the entity has a storage entry with the specified name.

      Parameters

      • name: string

        The name of the storage entry.

      Returns boolean

      Whether the entity has the storage entry or not.

    • Whether or not the entity has a tag.

      Parameters

      • tag: string

        The tag to check.

      Returns boolean

      Whether or not the entity has the tag.

    • Removes an effect from the entity.

      Parameters

      • effectType: EffectType

        The effect type to remove from the entity

      Returns void

    • Removes a storage entry from the entity.

      Parameters

      • name: string

        The name of the storage entry to remove.

      Returns void

    • Removes a tag from the entity.

      Parameters

      • tag: string

        The tag to remove.

      Returns boolean

      Whether or not the tag was removed.

    • Set the collision height of the entity.

      Parameters

      • height: number

        The collision height to set.

      Returns void

      This method depends on the EntityCollisionTrait trait.

    • Set the collision width of the entity.

      Parameters

      • width: number

        The collision width to set.

      Returns void

      This method depends on the EntityCollisionTrait trait.

    • Sets the gravity force of the entity.

      Parameters

      • force: number

        The gravity force to set.

      Returns void

      This method depends on the EntityGravityTrait trait.

    • Set whether the nametag is always visible.

      Parameters

      • visible: boolean

        Whether the nametag should be always visible.

      Returns void

    • Sets and sends the entity head rotation

      Parameters

      • rotation: Rotation

        The new entity's head rotation

      Returns void

    • Sets a storage entry in the entity.

      Type Parameters

      • T extends BaseTag

      Parameters

      • name: string

        The name of the storage entry.

      • entry: T

        The storage entry to set.

      Returns void

    • Teleport the entity to a new position.

      Parameters

      • position: Vector3f

        The position to teleport the entity to.

      • Optionaldimension: Dimension

        The dimension to teleport the entity to; optional.

      Returns void

    • Creates a new unique id for the entity.

      Parameters

      • network: number

        The network id of the entity type

      • runtimeId: bigint

        The current runtime id of the entity

      Returns bigint

      A generated unique id for the entity