Options
All
  • Public
  • Public/Protected
  • All
Menu

Module used to manipulate player. Player is also an entity in Minecraft, so you can use all the functions from Entity module as well. To get player's entity id, call Player.get function

Index

Functions

  • addExperience(exp: number): void
  • Adds specified amount of experience to the current value

    Parameters

    • exp: number

      amount to be added

    Returns void

  • addItemToInventory(id: number, count: number, data: number, extra?: ItemExtraData, preventDrop?: boolean): void
  • Adds items to player's inventory, stacking them if possible

    Parameters

    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    • Optional preventDrop: boolean

    Returns void

  • addLevel(level: number): void
  • Adds specified amount of level to the current value

    Parameters

    • level: number

      amount to be added

    Returns void

  • addPosition(x: number, y: number, z: number): void
  • Changes current player position by specified vector

    Parameters

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

    Returns void

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

    Parameters

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

    Returns void

  • decreaseCarriedItem(count?: number): void
  • Decreases carried item count by specified number

    Parameters

    • Optional count: number

      amount of items to decrease carried item by, default value is 1

    Returns void

  • get(): number
  • getBooleanAbility(ability: string): number
  • Gets one of the player's {@page Abilities} in a boolean form

    Parameters

    Returns number

    the current value of the ability in a boolean form

  • getDimension(): number
  • getExhaustion(): number
  • getExperience(): number
  • getFloatAbility(ability: string): number
  • Gets one of the player's {@page Abilities} in a form of floating-point number

    Parameters

    Returns number

    the current value of the ability in a form of floating-point number

  • getFlying(): boolean
  • getFlyingEnabled(): boolean
  • getHealth(): number
  • getHunger(): number
  • getInventory(loadPart: any, handleEnchant: any, handleNames: any): void
  • deprecated

    No longer supported

    Parameters

    • loadPart: any
    • handleEnchant: any
    • handleNames: any

    Returns void

  • getLevel(): number
  • getName(): void
  • getNameForEnt(ent: number): string
  • getSaturation(): number
  • getScore(): number
  • getSelectedSlotId(): number
  • isPlayer(ent: number): boolean
  • Parameters

    • ent: number

    Returns boolean

    true if specified entity is of player type, false otherwise

  • resetCameraEntity(): void
  • Resets player's camera if it was previously set to another entity

    Returns void

  • resetFov(): void
  • setAbility(ability: string, value: number | boolean): void
  • Sets some of the player's {@page Abilities}. If the argument is of type Boolean, sets the ability as the boolean one, otherwise as numeric one

    Parameters

    • ability: string

      ability name constant, should be one of the Native.PlayerAbility constants

    • value: number | boolean

      the value to be set for the ability. Can be either boolean or number, depending on the ability

    Returns void

  • setArmorSlot(slot: number, id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets contents of the specified armor slot

    Parameters

    • 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

  • setCameraEntity(ent: number): void
  • Sets player's camera to the specified entity

    Parameters

    • ent: number

      entity id

    Returns void

  • setCarriedItem(id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets item in player's hand

    Parameters

    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    Returns void

  • setExhaustion(value: number): void
  • Sets player's exhaustion

    Parameters

    • value: number

      exhaustion value to be set

    Returns void

  • setExperience(exp: number): void
  • Sets player's experience

    Parameters

    • exp: number

      experience value to be set

    Returns void

  • setFlying(enabled: boolean): void
  • setFlyingEnabled(enabled: boolean): void
  • Enables or disables player's ability to fly

    Parameters

    • enabled: boolean

      whether the player can fly or not

    Returns void

  • setFov(fov: number): void
  • setHealth(value: number): void
  • Sets player's health

    Parameters

    • value: number

      health value to be set

    Returns void

  • setHunger(value: number): void
  • Sets player's hunger

    Parameters

    • value: number

      hunger value to be set

    Returns void

  • setInventorySlot(slot: number, id: number, count: number, data: number, extra?: ItemExtraData): void
  • Sets contents of the specified inventory slot

    Parameters

    • slot: number

      slot id, from 0 to 36

    • id: number

      item id

    • count: number

      item count

    • data: number

      item data

    • Optional extra: ItemExtraData

      item extra

    Returns void

  • setLevel(level: number): void
  • Sets player's level

    Parameters

    • level: number

      level value to be set

    Returns void

  • setPosition(x: number, y: number, z: number): void
  • Sets specified coordinates as player's position

    Parameters

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

    Returns void

  • setSaturation(value: number): void
  • Sets player's saturation

    Parameters

    • value: number

      saturation value to be set

    Returns void

  • setSelectedSlotId(slot: number): void
  • Selects currently selected inventory slot

    Parameters

    • slot: number

      slot id to be selected, from 0 to 8

    Returns void

  • setVelocity(x: number, y: number, z: number): void
  • Set player's velocity using velocity vector

    Parameters

    • x: number

      velocity

    • y: number

      velocity

    • z: number

      velocity

    Returns void

Generated using TypeDoc