PlayerAPI

subclasses LivingEntityAPI

Acts as a proxy for a player entity in the Minecraft world
A global instance exists for the avatar's user,
under the name "player"

PlayerAPI.getExperienceLevel

Example by JimmyHelp:
Gets the player's current level
overload 1:
player:getExperienceLevel()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.isFlying

Example by JimmyHelp:
figura.docs.player.is_flying
overload 1:
player:isFlying()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getModelType

Example by JimmyHelp:
Returns "SLIM" or "DEFAULT", depending on the player's model type
overload 1:
player:getModelType()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.getFood

Example by JimmyHelp:
Gets the current food level of the player, from 0 to 20
overload 1:
player:getFood()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getSaturation

Example by JimmyHelp:
Gets the current saturation level of the player
overload 1:
player:getSaturation()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.isSkinLayerVisible

Example by JimmyHelp:
Returns whether the specified skin layer, from the Skin Customizations settings, is currently visible
overload 1:
player:isSkinLayerVisible(part)
Method Property Fluent Description Representation
part accepts a String
Return Value a Boolean

PlayerAPI.getGamemode

Example by JimmyHelp:
Returns "SURVIVAL", "CREATIVE", "ADVENTURE", or "SPECTATOR" depending on the player's gamemode
If the gamemode is unknown,
returns nil
overload 1:
player:getGamemode()
Method Property Fluent Description Representation
Return Value either a String or nil

PlayerAPI.getExperienceProgress

Gets the progress of the way towards the player's next level, as a value from 0 to 1
overload 1:
player:getExperienceProgress()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.getSwingDuration

Inherited from LivingEntityAPI

Returns the number of ticks this entity will have while swinging its arms
overload 1:
player:getSwingDuration()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getHealth

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the amount of health this entity has remaining
overload 1:
player:getHealth()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.getMaxHealth

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the maximum amount of health this entity can have
overload 1:
player:getMaxHealth()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.getDeathTime

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the number of ticks this entity has been dead for
overload 1:
player:getDeathTime()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.getArmor

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the amount of armor points this entity has
overload 1:
player:getArmor()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.getHeldItem

Inherited from LivingEntityAPI

Returns an ItemStack representing the item in this entity's main hand
If true is passed in for "offhand",
then it will instead look at the item in the entity's offhand
If the entity isn't holding an item in that hand,
returns air
overload 1:
player:getHeldItem()
Method Property Fluent Description Representation
Return Value an ItemStack
overload 2:
player:getHeldItem(offhand)
Method Property Fluent Description Representation
offhand accepts a Boolean
Return Value an ItemStack

PlayerAPI.getActiveItem

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns an ItemStack representing the item the entity is currently using
If they're not using any item,
returns air
overload 1:
player:getActiveItem()
Method Property Fluent Description Representation
Return Value an ItemStack

PlayerAPI.getActiveItemTime

Inherited from LivingEntityAPI

Returns the ticks this entity's active item has been used for
overload 1:
player:getActiveItemTime()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getBodyYaw

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the yaw of this entity's body in degrees
If delta is passed in,
then it will be used to linearly interpolate the rotation of the body between the previous tick and the current tick
The default value of delta is 1
overload 1:
player:getBodyYaw()
Method Property Fluent Description Representation
Return Value a Number
overload 2:
player:getBodyYaw(delta)
Method Property Fluent Description Representation
delta accepts a Number
Return Value a Number

PlayerAPI.getSwingArm

Inherited from LivingEntityAPI

Returns "OFF_HAND" or "MAIN_HAND", based on the arm this entity is currently swinging
overload 1:
player:getSwingArm()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.getStatusEffects

Inherited from LivingEntityAPI

Example by JimmyHelp:
figura.docs.living_entity.get_status_effects
overload 1:
player:getStatusEffects()
Method Property Fluent Description Representation
Return Value a table

PlayerAPI.isLeftHanded

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if the entity's main hand is its left
overload 1:
player:isLeftHanded()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isUsingItem

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if the entity is currently using an item
overload 1:
player:isUsingItem()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isClimbing

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if the entity is currently using a climbable block, like a ladder or vine
overload 1:
player:isClimbing()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getActiveHand

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns "OFF_HAND" or "MAIN_HAND", depending on which hand this entity uses an item with
overload 1:
player:getActiveHand()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.getArrowCount

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the number of arrows sticking out of this entity
overload 1:
player:getArrowCount()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getStingerCount

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the number of bee stingers sticking out of this entity
overload 1:
player:getStingerCount()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.isSwingingArm

Inherited from LivingEntityAPI

Returns true if the entity is currently swinging its arm
overload 1:
player:isSwingingArm()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getSwingTime

Inherited from LivingEntityAPI

Returns the number of ticks this entity has the arm swinging
overload 1:
player:getSwingTime()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getName

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the name of this entity, if it has a custom name
If it doesn't,
returns a translated form of getType()
overload 1:
player:getName()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.getType

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the Minecraft identifier of this entity
For instance,
"minecraft:pig"
overload 1:
player:getType()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.isLoaded

Inherited from LivingEntityAPI

Example by JimmyHelp:
Checks if this entity object is still being updated and loaded
A non-loaded entity would be someone or something which is in another dimension or out of the render distance for example
overload 1:
player:isLoaded()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getItem

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets an ItemStack for the item in the given slot
For the player,
slots are indexed with 1 as the main hand, 2 as the off hand, and 3,4,5,6 as the 4 armor slots from the boots to the helmet
If an invalid slot number is given,
this will return nil
overload 1:
player:getItem(index)
Method Property Fluent Description Representation
index accepts an Integer
Return Value an ItemStack

PlayerAPI.getNbt

Inherited from LivingEntityAPI

Gets a table containing the NBT of this entity
Please note that not all values in the entity's NBT may be synced,
as some are handled only on the server side
overload 1:
player:getNbt()
Method Property Fluent Description Representation
Return Value a table

PlayerAPI.getPose

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the current pose of the player
This can be one of: "STANDING",
"FALL_FLYING", "SLEEPING", "SWIMMING", "SPIN_ATTACK", "CROUCHING", "LONG_JUMPING", or "DYING"
overload 1:
player:getPose()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.getPos

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the position of the entity in the world
If delta is passed in,
then it will be used to linearly interpolate the position of the entity between the previous tick and the current tick
The default value of delta is 1
overload 1:
player:getPos()
Method Property Fluent Description Representation
Return Value a Vector3
overload 2:
player:getPos(delta)
Method Property Fluent Description Representation
delta accepts a Number
Return Value a Vector3

PlayerAPI.getVehicle

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns a proxy for the entity that this player is currently riding
If the player isn't riding anything,
returns nil
overload 1:
player:getVehicle()
Method Property Fluent Description Representation
Return Value an EntityAPI

PlayerAPI.getRot

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the rotation of the entity in degrees
If delta is passed in,
then it will be used to linearly interpolate the rotation of the entity between the previous tick and the current tick
The default value of delta is 1
overload 1:
player:getRot()
Method Property Fluent Description Representation
Return Value a Vector2
overload 2:
player:getRot(delta)
Method Property Fluent Description Representation
delta accepts a Number
Return Value a Vector2

PlayerAPI.getUUID

Inherited from LivingEntityAPI

Gets the UUID of the proxied entity
overload 1:
player:getUUID()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.isHamburger

Inherited from LivingEntityAPI

Example by JimmyHelp:
figura.docs.entity.is_hamburger
overload 1:
player:isHamburger()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getLookDir

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns a unit vector pointing in the direction that this entity is looking
See the blue line in the F3+B screen for an example
overload 1:
player:getLookDir()
Method Property Fluent Description Representation
Return Value a Vector3

PlayerAPI.getFrozenTicks

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the number of ticks this entity has been freezing in powder snow for
overload 1:
player:getFrozenTicks()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getVelocity

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the current velocity of this entity in world coordinates, calculated as its position this tick minus its position last tick
overload 1:
player:getVelocity()
Method Property Fluent Description Representation
Return Value a Vector3

PlayerAPI.getMaxAir

Inherited from LivingEntityAPI

Example by JimmyHelp:
Gets the maximum amount of air this entity can have
overload 1:
player:getMaxAir()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getFireTicks

Inherited from LivingEntityAPI

figura.docs.entity.get_fire_ticks
overload 1:
player:getFireTicks()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.getDimensionName

Inherited from LivingEntityAPI

Gets the Minecraft identifier of the dimension this entity is in
overload 1:
player:getDimensionName()
Method Property Fluent Description Representation
Return Value a String

PlayerAPI.getAir

Inherited from LivingEntityAPI

Example by JimmyHelp:
figura.docs.entity.get_air
overload 1:
player:getAir()
Method Property Fluent Description Representation
Return Value an Integer

PlayerAPI.isInLava

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is currently in lava
overload 1:
player:isInLava()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isOnFire

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is currently on fire
overload 1:
player:isOnFire()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isOnGround

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns whether or not this entity is currently on the ground
overload 1:
player:isOnGround()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isSneaking

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is logically sneaking (can't fall from blocks edges, can't see nameplate behind walls, etc)
overload 1:
player:isSneaking()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getEyeY

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the Y level of this entity's eyes
Not to be confused with getEyeHeight,
this function also takes the entity itself's Y position into account
overload 1:
player:getEyeY()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.getBoundingBox

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the size of this entity's bounding box as a Vector3
{x,
y, z} are the width, height, and width
Minecraft entity hitboxes always have square bases
overload 1:
player:getBoundingBox()
Method Property Fluent Description Representation
Return Value a Vector3

PlayerAPI.isInRain

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is currently standing in rain
overload 1:
player:isInRain()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isUnderwater

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity's eyes are touching water
overload 1:
player:isUnderwater()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isInWater

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is currently in a water block, including waterlogging
overload 1:
player:isInWater()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isSilent

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is silent
overload 1:
player:isSilent()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.hasAvatar

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if Figura has an avatar loaded for this entity
overload 1:
player:hasAvatar()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getEyeHeight

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns the current eye height of this entity
overload 1:
player:getEyeHeight()
Method Property Fluent Description Representation
Return Value a Number

PlayerAPI.isSprinting

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is currently sprinting
overload 1:
player:isSprinting()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isGlowing

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is currently glowing
overload 1:
player:isGlowing()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isInvisible

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true if this entity is invisible, for one reason or another
overload 1:
player:isInvisible()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.isWet

Inherited from LivingEntityAPI

Example by JimmyHelp:
Returns true in any of three conditions: if the entity is in water, if the entity is in rain, or if the entity is in a bubble column
Otherwise,
returns false
overload 1:
player:isWet()
Method Property Fluent Description Representation
Return Value a Boolean

PlayerAPI.getTargetedBlock

Inherited from LivingEntityAPI

Returns a proxy for your currently targeted BlockState
This BlockState appears on the F3 screen
The maximum (and default) distance is 20,
minimum is -20
Returns the block, the hit position,
and the targeted block face as three separate values
overload 1:
player:getTargetedBlock()
Method Property Fluent Description Representation
Return Value a BlockState
overload 2:
player:getTargetedBlock(ignoreLiquids)
Method Property Fluent Description Representation
ignoreLiquids accepts a Boolean
Return Value a BlockState
overload 3:
player:getTargetedBlock(ignoreLiquids, distance)
Method Property Fluent Description Representation
ignoreLiquids accepts a Boolean
distance accepts a Number
Return Value a BlockState

PlayerAPI.getVariable

Inherited from LivingEntityAPI

Gets the value of a variable this entity stored in themselves using the Avatar API's store() function
overload 1:
player:getVariable(key)
Method Property Fluent Description Representation
key accepts a String
Return Value anything
a a