PlayerEntity
Index
Constructors
Properties
Methods
- addExperience
- addItemToInventory
- decreaseCarriedItem
- getArmor
- getCarriedItem
- getDimension
- getExhaustion
- getExperience
- getGameMode
- getHunger
- getInventorySlot
- getItemUseDuration
- getItemUseIntervalProgress
- getItemUseStartupProgress
- getLevel
- getSaturation
- getScore
- getSelectedSlot
- getUid
- isValid
- setArmor
- setCarriedItem
- setExhaustion
- setExperience
- setHunger
- setInventorySlot
- setLevel
- setRespawnCoords
- setSaturation
- setScore
- setSelectedSlot
- spawnExpOrbs
Constructors
constructor
Creates new instance of
PlayerEntity
.Parameters
playerUid: number
player's numeric entity id
Returns PlayerEntity
Properties
readonlyactor
privatereadonlyplayerUid
Methods
addExperience
Add experience to player.
Parameters
amount: number
Returns void
addItemToInventory
Adds item to player's inventory. Drops surplus items near player.
Parameters
item: ItemInstance
Returns void
decreaseCarriedItem
Decreases carried item count by specified number.
Parameters
optionalamount: number
amount of items to decrease, default is 1
Returns void
getArmor
Parameters
slot: number
Returns ItemInstance
armor slot's contents.
getCarriedItem
Returns ItemStack
item in player's hand
getDimension
Returns number
the id of dimension where player is.
getExhaustion
Returns number
player's exhaustion.
getExperience
Returns number
player's experience.
getGameMode
Returns number
player's gamemode.
getHunger
Returns number
player's hunger.
getInventorySlot
Parameters
slot: number
Returns ItemStack
inventory slot's contents.
getItemUseDuration
Returns number
getItemUseIntervalProgress
Returns number
getItemUseStartupProgress
Returns number
getLevel
Returns number
player's xp level.
getSaturation
Returns number
player's saturation.
getScore
Returns number
player's score.
getSelectedSlot
Returns number
player's selected slot.
getUid
Returns number
player's unique numeric entity id.
isValid
Returns boolean
whether the player is a valid entity.
setArmor
Sets armor slot's contents.
Parameters
slot: number
item: ItemInstance
Returns void
setCarriedItem
Sets item in player's hand.
Parameters
item: ItemInstance
Returns void
setExhaustion
Sets player's exhaustion.
Parameters
value: number
Returns void
setExperience
Sets player's experience.
Parameters
value: number
Returns void
setHunger
Sets player's hunger.
Parameters
value: number
Returns void
setInventorySlot
Sets inventory slot's contents.
Parameters
slot: number
item: ItemInstance
Returns void
setLevel
Sets player's xp level.
Parameters
level: number
Returns void
setRespawnCoords
Sets respawn coords for the player.
Parameters
x: number
y: number
z: number
Returns void
setSaturation
Sets player's saturation.
Parameters
value: number
Returns void
setScore
Sets player's score.
Parameters
value: number
Returns void
setSelectedSlot
Sets player's selected slot.
Parameters
slot: number
Returns void
spawnExpOrbs
Spawns exp on coords.
Parameters
x: number
y: number
z: number
value: number
experience points value
Returns void
Class to manipulate player based on
PlayerActor
. Due to limitations of underlying PlayerActor class this class can be used only during 1 server tick!