Options
All
  • Public
  • Public/Protected
  • All
Menu

Module used to manipulate entities (mobs, drop, arrows, etc.) in the world. Every entity has its unique numeric id which is often used across this module as the first function parameter

Index

Functions

  • addEffect(ent: number, effectId: number, effectData: number, effectTime: number, ambience?: boolean, particles?: boolean): void
  • Adds an effect to the mob

    Parameters

    • ent: number
    • effectId: number

      effect id, should be one one of Native.PotionEffect or EPotionEffect values.

    • effectData: number

      effect amplifier

    • effectTime: number

      effect time in ticks

    • Optional ambience: boolean

      if true, particles are ambient

    • Optional particles: boolean

      if true, particles are not displayed

    Returns void

    whether the ]] values

  • addPosition(ent: number, x: number, y: number, z: number): void
  • Updates current entity position by specified coordinates

    Parameters

    • ent: number
    • x: number
    • y: number
    • z: number

    Returns void

  • addVelocity(ent: number, x: number, y: number, z: number): void
  • Updates current entity's velocity by specified value

    Parameters

    • ent: number
    • x: number
    • y: number
    • z: number

    Returns void

  • clearEffect(ent: number, id: number): void
  • clearEffects(ent: number): void
  • damageEntity(ent: number, damage: number, cause?: number, params?: { attacker?: number; bool1?: boolean; bool2?: boolean }): void
  • Damages entity

    Parameters

    • ent: number
    • damage: number

      damage value

    • Optional cause: number

      if specified, can be used as callback cause param

    • Optional params: { attacker?: number; bool1?: boolean; bool2?: boolean }

      additional params for the damage

      • Optional attacker?: number

        entity that caused damage, can be used as callback cause param

      • Optional bool1?: boolean

        if true, damage is reduced by entity armor

      • Optional bool2?: boolean

        unknown param

    Returns void

  • findNearest(coords: Vector, type?: number, maxRange?: number): Nullable<number>
  • Retrieves nearest to the coordinates entity of the specified entity type

    Parameters

    • coords: Vector

      search range center coordinates

    • Optional type: number

      entity type ID. Parameter is no longer supported and should be 0 in all cases

    • Optional maxRange: number

      if specified, determines search radius

    Returns Nullable<number>

  • getAge(ent: number): number
  • getAll(): number[]
  • getAllInRange(coords: Vector, maxRange: number, type?: number): number[]
  • Returns array of all entities' numeric ids in given range in blocks

    Parameters

    • coords: Vector

      search range center coordinates

    • maxRange: number

      determines search radius

    • Optional type: number

      entity type ID. Parameter is no longer supported and should not be used

    Returns number[]

  • getAllInsideBox(pos1: Vector, pos2: Vector, type?: number, flag?: boolean): any
  • getAllJS(): number[]
  • Creates an object used to change entity's attributes. See {@page Attributes} page for details.

    Parameters

    • ent: number
    • attribute: string

    Returns AttributeInstance

    object used to manipulate entity's attributes

  • getDimension(ent: number): number
  • getDistanceBetweenCoords(coords1: Vector, coords2: Vector): number
  • getDistanceToCoords(ent: number, coords: Vector): number
  • Parameters

    Returns number

    distance between specified entity and a fixed coordinate set

  • getDistanceToEntity(ent1: number, ent2: number): number
  • Parameters

    • ent1: number
    • ent2: number

    Returns number

    distance in blocks between two entities

  • Parameters

    • entity: number
    • effectId: number

    Returns EffectInstance

    object with duration and level of the potion effect with given numeric id on the given entity. These fields are set to 0, if the given effect doesn't affect the given entity at the moment.

  • getExtra(ent: number, name: string): null
  • deprecated

    No longer supported

    Parameters

    • ent: number
    • name: string

    Returns null

  • getExtraJson(ent: number, name: string): object
  • deprecated

    No longer supported

    Parameters

    • ent: number
    • name: string

    Returns object

  • getHealth(ent: number): number
  • getInventory(ent: number, handleNames?: boolean, handleEnchant?: boolean): void
  • deprecated

    No longer supported

    Parameters

    • ent: number
    • Optional handleNames: boolean
    • Optional handleEnchant: boolean

    Returns void

  • getLookAt(ent: number, x: number, y: number, z: number): LookAngle
  • getLookVector(ent: number): Vector
  • getMaxHealth(ent: number): number
  • getMobile(ent: number): boolean
  • Retrieves entity look angle in the form of pitch/yaw angle. No other information included to the resulting object

    Parameters

    • ent: number

    Returns LookAngle

  • getMovingAngleByPositions(pos1: any, pos2: any): void
  • Retrieves entity's current movement information

    Parameters

    • ent: number

    Returns MovingVector

    object that contains normalized moving vector, moving speed and moving xz speed (with no Y coordinate)

  • getNameTag(ent: number): string
  • getPosition(ent: number): Vector
  • getRender(ent: number): number
  • getRider(ent: number): number
  • Parameters

    • ent: number

    Returns number

    entity that is riding the specified entity

  • getRiding(ent: number): number
  • Parameters

    • ent: number

    Returns number

    entity that is ridden by specified entity

  • getSkin(ent: number): string
  • getSneaking(ent: number): boolean
  • Parameters

    • ent: number

    Returns boolean

    true if entity is sneaking, false otherwise

  • getTarget(ent: number): number
  • Gets the attack target of current entity

    Parameters

    • ent: number

    Returns number

    target entity's unique id

  • getType(ent: number): number
  • getTypeAddon(ent: number): Nullable<string>
  • getTypeUniversal(ent: number): number | string
  • Parameters

    • ent: number

    Returns number | string

    string type for entities defined via add-ons or numeric type for all the other entities

  • getVelocity(ent: number): Vector
  • getXZPlayerDis(ent: number): number
  • Parameters

    • ent: number

    Returns number

    distance between player and entity, counting only x and z values (y value is ignored)

  • hasEffect(entity: number, effectId: number): boolean
  • healEntity(ent: number, heal: number): void
  • Adds specified health amount to the entity

    Parameters

    • ent: number
    • heal: number

      health to be added to entity, in half-hearts

    Returns void

  • isExist(ent: number): boolean
  • Parameters

    • ent: number

    Returns boolean

    true if specified entity id is valid and entity with this id exists in the world

  • lookAt(ent: number, x: number, y: number, z: number): void
  • Sets entity look angle to look at specified coordinates

    Parameters

    • ent: number
    • x: number
    • y: number
    • z: number

    Returns void

  • lookAtCoords(ent: number, coords: Vector): void
  • Makes entity move using pitch/yaw angle to determine direction

    Parameters

    • ent: number
    • angle: LookAngle

      angle to define entity's direction

    • params: MoveParams

      additional move parameters

    Returns void

  • Makes entity move towards its current look angle

    Parameters

    • ent: number
    • params: MoveParams

      additional move parameters

    Returns void

  • putExtraJson(ent: number, name: string, obj: object): void
  • deprecated

    No longer supported

    Parameters

    • ent: number
    • name: string
    • obj: object

    Returns void

  • remove(ent: number): void
  • rideAnimal(entity: number, rider: number): void
  • Makes rider ride entity

    Parameters

    • entity: number

      ridden entity

    • rider: number

      rider entity

    Returns void

  • setAge(ent: number, age: number): void
  • deprecated

    No longer supported

    Parameters

    • ent: number
    • age: number

    Returns void

  • setArmorSlot(ent: number, slot: number, id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets armor slot contents for the entity

    Parameters

    • ent: number
    • slot: number

      armor slot id, should be one of the Native.ArmorType values

    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    Returns void

  • setCarriedItem(ent: number, id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets current carried item for the entity

    Parameters

    • ent: number
    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    Returns void

  • setDroppedItem(ent: number, id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets item to the specified drop entity

    Parameters

    • ent: number
    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    Returns void

  • setFire(ent: number, fire: number, force: boolean): void
  • Puts entity on fire

    Parameters

    • ent: number
    • fire: number

      duration (in ticks) of the fire

    • force: boolean

      should always be true

    Returns void

  • setHealth(ent: number, health: number): void
  • Sets entity's current health value

    Parameters

    • ent: number
    • health: number

      health value to be set

    Returns void

  • setHitbox(ent: number, w: number, h: number): void
  • Sets hitbox to the entity. Hitboxes define entities collisions

    Parameters

    • ent: number
    • w: number

      hitbox width and length

    • h: number

      hitbox height

    Returns void

  • setLookAngle(ent: number, yaw: number, pitch: number): void
  • Sets specified pitch and yaw as look angle for the entity

    Parameters

    • ent: number
    • yaw: number

      look angle yaw in radians

    • pitch: number

      look angle pitch in radians

    Returns void

  • setMaxHealth(ent: number, health: number): void
  • Sets entity's maximum health value

    Parameters

    • ent: number
    • health: number

    Returns void

  • setMobile(ent: number, mobile: boolean): void
  • Sets entity's immobile state

    Parameters

    • ent: number
    • mobile: boolean

      if true, entity can move, otherwise it is immobilized

    Returns void

  • setNameTag(ent: number, tag: string): void
  • Sets custom entity tag. Custom entity tags are displayed above the entities and can be set by player using label

    Parameters

    • ent: number
    • tag: string

      name tag to be set to the entity

    Returns void

  • setOffhandItem(ent: number, id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets current offhand item for the entity

    Parameters

    • ent: number
    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    Returns void

  • setPosition(ent: number, x: number, y: number, z: number): void
  • Sets the specified coordinates as a new position for the entity. No checks are performed

    Parameters

    • ent: number
    • x: number
    • y: number
    • z: number

    Returns void

  • setRender(ent: number, render: number): void
  • setSkin(ent: number, skin: string): void
  • Sets mob skin

    Parameters

    • ent: number
    • skin: string

      skin name, full path in the resourcepack (mod assets)

    Returns void

  • setSneaking(ent: number, sneak: boolean): void
  • Sets entity's sneaking state

    Parameters

    • ent: number
    • sneak: boolean

      if true, entity becomes sneaking, else not

    Returns void

  • setTarget(ent: number, target: number): void
  • Sets the attack target for current entity. Works only for mobs that actually can attack

    Parameters

    • ent: number
    • target: number

      target entity's unique id

    Returns void

  • setTexture(ent: number, texture: Texture): void
  • setVelocity(ent: number, x: number, y: number, z: number): void
  • Set current entity's velocity using velocity vector

    Parameters

    • ent: number
    • x: number

      velocity

    • y: number

      velocity

    • z: number

      velocity

    Returns void

  • spawn(x: number, y: number, z: number, type: number, skin?: string): number
  • Spawns vanilla entity on the specified coordinates

    Parameters

    • x: number
    • y: number
    • z: number
    • type: number

      numeric entity type, one of the Native.EntityType

    • Optional skin: string

      skin to set for the entity. Leave empty or null to use default skin of the mob

    Returns number

    numeric id of spawn entity or -1 if entity was not created

  • spawnAtCoords(coords: Vector, type: number, skin?: string): void
  • spawnCustom(name: string, x: number, y: number, z: number, extra?: object): CustomEntity
  • Spawns custom entity on the specified coords. Allows to pass some values to controllers via extra param

    Parameters

    • name: string

      custom entity string id

    • x: number
    • y: number
    • z: number
    • Optional extra: object

      object that contains some data for the controllers

    Returns CustomEntity

Generated using TypeDoc