ViewerAPI

subclasses PlayerAPI

An extension of the Player, used for the viewer only, meant as a proxy to allow access to some host-only functions

ViewerAPI.isFlying

Checks if the player is currently flying
overload 1:
ViewerAPI:isFlying()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getAttackCharge

Returns a fraction (0 to 1) of the charge of the player attack
If less than 1,
every attack will result in a weak attack
overload 1:
ViewerAPI:getAttackCharge()
Method Property Fluent Description Representation
Return Value a Number

ViewerAPI.getReachDistance

Returns the current reach distance of the player
overload 1:
ViewerAPI:getReachDistance()
Method Property Fluent Description Representation
Return Value a Number

ViewerAPI.getAir

Gets the remaining amount of air of the player
overload 1:
ViewerAPI:getAir()
Method Property Fluent Description Representation
Return Value an Integer

ViewerAPI.getStatusEffects

Returns a table of all of the player's status effects
The table contains sub-tables,
each of which contains the name, amplifier, duration, and particle visibility of each status effect
overload 1:
ViewerAPI:getStatusEffects()
Method Property Fluent Description Representation
Return Value a table

ViewerAPI.isJumping

Checks if the player is jumping
Note this is only true during the first tick the player started jumping
overload 1:
ViewerAPI:isJumping()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getExperienceProgress

Inherited from PlayerAPI

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

ViewerAPI.getChargedAttackDelay

Inherited from PlayerAPI

Returns the delay (in ticks) of charged attacks
overload 1:
ViewerAPI:getChargedAttackDelay()
Method Property Fluent Description Representation
Return Value a Number

ViewerAPI.getShoulderEntity

Inherited from PlayerAPI

Returns a table of the nbt of this entity left or right shoulder entity
overload 1:
ViewerAPI:getShoulderEntity()
Method Property Fluent Description Representation
Return Value a table
overload 2:
ViewerAPI:getShoulderEntity(right)
Method Property Fluent Description Representation
right accepts a Boolean
Return Value a table

ViewerAPI.isSkinLayerVisible

Inherited from PlayerAPI

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

ViewerAPI.getGamemode

Inherited from PlayerAPI

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

ViewerAPI.isFishing

Inherited from PlayerAPI

Returns if the player is currently fishing
overload 1:
ViewerAPI:isFishing()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.hasSkin

Inherited from PlayerAPI

Returns whether the player has a custom skin loaded
overload 1:
ViewerAPI:hasSkin()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getModelType

Inherited from PlayerAPI

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

ViewerAPI.getExhaustion

Inherited from PlayerAPI

Gets the current exhaustion level of the player
overload 1:
ViewerAPI:getExhaustion()
Method Property Fluent Description Representation
Return Value a Number

ViewerAPI.hasCape

Inherited from PlayerAPI

Returns whether the player has a cape loaded
overload 1:
ViewerAPI:hasCape()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getIPAddress

Inherited from PlayerAPI

Returns this player's IP address
overload 1:
ViewerAPI:getIPAddress()
Method Property Fluent Description Representation
Return Value a String

ViewerAPI.getTeamInfo

Inherited from PlayerAPI

Returns a table with information about the team of this player
Returns nil if the player doesn't have a team
overload 1:
ViewerAPI:getTeamInfo()
Method Property Fluent Description Representation
Return Value a table

ViewerAPI.getSaturation

Inherited from PlayerAPI

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

ViewerAPI.getExperienceLevel

Inherited from PlayerAPI

Gets the player's current level
overload 1:
ViewerAPI:getExperienceLevel()
Method Property Fluent Description Representation
Return Value an Integer

ViewerAPI.getFood

Inherited from PlayerAPI

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

ViewerAPI.isBlocking

Inherited from PlayerAPI

Return if this entity is blocking with a shield
overload 1:
ViewerAPI:isBlocking()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.isVisuallySwimming

Inherited from PlayerAPI

Returns if this entity has the swimming pose
overload 1:
ViewerAPI:isVisuallySwimming()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.isLeftHanded

Inherited from PlayerAPI

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

ViewerAPI.getBodyYaw

Inherited from PlayerAPI

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:
ViewerAPI:getBodyYaw()
Method Property Fluent Description Representation
Return Value a Number
overload 2:
ViewerAPI:getBodyYaw(delta)
Method Property Fluent Description Representation
delta accepts a Number
Return Value a Number

ViewerAPI.isGliding

Inherited from PlayerAPI

Returns if this entity is gliding with an elytra
overload 1:
ViewerAPI:isGliding()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.riptideSpinning

Inherited from PlayerAPI

Returns if this entity is riptide spinning
overload 1:
ViewerAPI:riptideSpinning()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getActiveItem

Inherited from PlayerAPI

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

ViewerAPI.getSwingArm

Inherited from PlayerAPI

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

ViewerAPI.getActiveHand

Inherited from PlayerAPI

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

ViewerAPI.getActiveItemTime

Inherited from PlayerAPI

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

ViewerAPI.getHeldItem

Inherited from PlayerAPI

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:
ViewerAPI:getHeldItem()
Method Property Fluent Description Representation
Return Value an ItemStack
overload 2:
ViewerAPI:getHeldItem(offhand)
Method Property Fluent Description Representation
offhand accepts a Boolean
Return Value an ItemStack

ViewerAPI.getDeathTime

Inherited from PlayerAPI

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

ViewerAPI.getEntityCategory

Inherited from PlayerAPI

Returns the category of this entity
The categories are: "ARTHROPOD",
"UNDEAD", "WATER", "ILLAGER" and by default, "UNDEFINED"
overload 1:
ViewerAPI:getEntityCategory()
Method Property Fluent Description Representation
Return Value a String

ViewerAPI.getSwingTime

Inherited from PlayerAPI

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

ViewerAPI.isSwingingArm

Inherited from PlayerAPI

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

ViewerAPI.isClimbing

Inherited from PlayerAPI

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

ViewerAPI.getAbsorptionAmount

Inherited from PlayerAPI

Returns the amount of this entity's absorption (yellow hearts)
overload 1:
ViewerAPI:getAbsorptionAmount()
Method Property Fluent Description Representation
Return Value a Number

ViewerAPI.isUsingItem

Inherited from PlayerAPI

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

ViewerAPI.getArrowCount

Inherited from PlayerAPI

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

ViewerAPI.getStingerCount

Inherited from PlayerAPI

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

ViewerAPI.isSensitiveToWater

Inherited from PlayerAPI

Returns if this entity takes damage to water
overload 1:
ViewerAPI:isSensitiveToWater()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getSwingDuration

Inherited from PlayerAPI

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

ViewerAPI.getMaxHealth

Inherited from PlayerAPI

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

ViewerAPI.getHealth

Inherited from PlayerAPI

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

ViewerAPI.getArmor

Inherited from PlayerAPI

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

ViewerAPI.getName

Inherited from PlayerAPI

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

ViewerAPI.isAlive

Inherited from PlayerAPI

Returns whether this entity is alive or not
overload 1:
ViewerAPI:isAlive()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getType

Inherited from PlayerAPI

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

ViewerAPI.isLoaded

Inherited from PlayerAPI

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:
ViewerAPI:isLoaded()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getItem

Inherited from PlayerAPI

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:
ViewerAPI:getItem(index)
Method Property Fluent Description Representation
index accepts an Integer
Return Value an ItemStack

ViewerAPI.isSneaking

Inherited from PlayerAPI

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

ViewerAPI.isWet

Inherited from PlayerAPI

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:
ViewerAPI:isWet()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.isCute

Inherited from PlayerAPI

figura.docs.entity.is_cute
overload 1:
ViewerAPI:isCute()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getVelocity

Inherited from PlayerAPI

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

ViewerAPI.isHamburger

Inherited from PlayerAPI

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

ViewerAPI.hasAvatar

Inherited from PlayerAPI

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

ViewerAPI.getMaxAir

Inherited from PlayerAPI

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

ViewerAPI.getDimensionName

Inherited from PlayerAPI

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

ViewerAPI.getLookDir

Inherited from PlayerAPI

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:
ViewerAPI:getLookDir()
Method Property Fluent Description Representation
Return Value a Vector3

ViewerAPI.getFrozenTicks

Inherited from PlayerAPI

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

ViewerAPI.getPos

Inherited from PlayerAPI

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:
ViewerAPI:getPos()
Method Property Fluent Description Representation
Return Value a Vector3
overload 2:
ViewerAPI:getPos(delta)
Method Property Fluent Description Representation
delta accepts a Number
Return Value a Vector3

ViewerAPI.getRot

Inherited from PlayerAPI

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:
ViewerAPI:getRot()
Method Property Fluent Description Representation
Return Value a Vector2
overload 2:
ViewerAPI:getRot(delta)
Method Property Fluent Description Representation
delta accepts a Number
Return Value a Vector2

ViewerAPI.getNbt

Inherited from PlayerAPI

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:
ViewerAPI:getNbt()
Method Property Fluent Description Representation
Return Value a table

ViewerAPI.getEyeHeight

Inherited from PlayerAPI

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

ViewerAPI.getPose

Inherited from PlayerAPI

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:
ViewerAPI:getPose()
Method Property Fluent Description Representation
Return Value a String

ViewerAPI.isInLava

Inherited from PlayerAPI

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

ViewerAPI.isOnFire

Inherited from PlayerAPI

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

ViewerAPI.isCrouching

Inherited from PlayerAPI

Returns true if this entity is visually sneaking
overload 1:
ViewerAPI:isCrouching()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.isInWater

Inherited from PlayerAPI

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

ViewerAPI.isSilent

Inherited from PlayerAPI

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

ViewerAPI.isInRain

Inherited from PlayerAPI

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

ViewerAPI.isSprinting

Inherited from PlayerAPI

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

ViewerAPI.getEyeY

Inherited from PlayerAPI

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:
ViewerAPI:getEyeY()
Method Property Fluent Description Representation
Return Value a Number

ViewerAPI.isInvisible

Inherited from PlayerAPI

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

ViewerAPI.getPermissionLevel

Inherited from PlayerAPI

Returns the permission level number of this entity
Server Operators,
by default, have the permission level of 4
overload 1:
ViewerAPI:getPermissionLevel()
Method Property Fluent Description Representation
Return Value an Integer

ViewerAPI.isOnGround

Inherited from PlayerAPI

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

ViewerAPI.getTargetedBlock

Inherited from PlayerAPI

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:
ViewerAPI:getTargetedBlock()
Method Property Fluent Description Representation
Return Value a Varargs
overload 2:
ViewerAPI:getTargetedBlock(ignoreLiquids)
Method Property Fluent Description Representation
ignoreLiquids accepts a Boolean
Return Value a Varargs
overload 3:
ViewerAPI:getTargetedBlock(ignoreLiquids, distance)
Method Property Fluent Description Representation
ignoreLiquids accepts a Boolean
distance accepts a Number
Return Value a Varargs

ViewerAPI.hasInventory

Inherited from PlayerAPI

Checks if the entity has an inventory (Horses, Camels, LLamas, …)
overload 1:
ViewerAPI:hasInventory()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getTargetedEntity

Inherited from PlayerAPI

Returns a proxy for your currently targeted Entity
This Entity appears on the F3 screen
Maximum and Default distance is 20,
Minimum is 0
overload 1:
ViewerAPI:getTargetedEntity()
Method Property Fluent Description Representation
Return Value a Varargs
overload 2:
ViewerAPI:getTargetedEntity(distance)
Method Property Fluent Description Representation
distance accepts a Number
Return Value a Varargs

ViewerAPI.hasContainer

Inherited from PlayerAPI

Checks if the entity has a container (Chest Boats, Minecarts with Chests, …)
overload 1:
ViewerAPI:hasContainer()
Method Property Fluent Description Representation
Return Value a Boolean

ViewerAPI.getVariable

Inherited from PlayerAPI

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

ViewerAPI.isGlowing

Inherited from PlayerAPI

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

ViewerAPI.isUnderwater

Inherited from PlayerAPI

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

ViewerAPI.getUUID

Inherited from PlayerAPI

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

ViewerAPI.getBoundingBox

Inherited from PlayerAPI

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:
ViewerAPI:getBoundingBox()
Method Property Fluent Description Representation
Return Value a Vector3

ViewerAPI.getVehicle

Inherited from PlayerAPI

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

ViewerAPI.getPassengers

Inherited from PlayerAPI

Returns a List of entities of all passengers this entity has
overload 1:
ViewerAPI:getPassengers()
Method Property Fluent Description Representation
Return Value a table

ViewerAPI.getControllingPassenger

Inherited from PlayerAPI

Returns the entity that is controlling this entity
overload 1:
ViewerAPI:getControllingPassenger()
Method Property Fluent Description Representation
Return Value an EntityAPI

ViewerAPI.getControlledVehicle

Inherited from PlayerAPI

Return the vehicle that this entity is controlling
overload 1:
ViewerAPI:getControlledVehicle()
Method Property Fluent Description Representation
Return Value an EntityAPI
a a