SerenityJS
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    attributes: AttributeMap

    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: MetadataMap

    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.

    position: Vector3f = ...

    The current position of the entity

    rotation: Rotation = ...

    The current rotation of the entity

    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: EntitySharedPropertiesMap

    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.

    tags: Set<string> = ...

    The tags that are attached to the entity

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

    The traits that are attached to the entity

    The type of the entity.

    uniqueId: bigint

    The unique id of the entity. (Generated by the server, and exists for the lifetime 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 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 the shared property of the entity that is shared with the client.

      Type Parameters

      • T extends string | number | boolean

      Parameters

      • identifier: string

        The identifier of the property.

      Returns null | T

      The value of the property.

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

      Returns Vector3f

      A Vector3f representing the direction the view is pointing.

    • Whether the entity has the specified component.

      Parameters

      • key: string

        The key of the component.

      Returns boolean

      Whether the entity has the component or not.

    • 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.

    • 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.

    • Loads the entity from the provided entity entry.

      Parameters

      • world: World

        The world to the entity data is coming from

      • entry: EntityEntry

        The entity entry to load

      • overwrite: boolean = true

        Whether to overwrite the current entity data; default is true

      Returns void

    • Removes the specified component from the entity.

      Parameters

      • key: string

        The key of the component.

      Returns void

    • Removes an effect from the entity.

      Parameters

      • effectType: EffectType

        The effect type to remove from the entity

      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.

    • Sets and sends the entity head rotation

      Parameters

      • rotation: Rotation

        The new entity's head rotation

      Returns void

    • Sets the shared property of the entity that is shared with the client.

      Type Parameters

      • T extends string | number | boolean

      Parameters

      • identifier: string

        The identifier of the property.

      • value: T

        The value of the property.

      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