Buy Me a Coffee at ko-fi.com

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

Returns the amount of this entity's absorption (yellow hearts)

overload 1:
ViewerAPI.getAbsorptionAmount(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Returns "OFF_HAND" or "MAIN_HAND", depending on which hand this entity uses an item with

overload 1:
ViewerAPI.getActiveHand(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Returns an ItemStack representing the item the entity is currently using
If they're not using any item, returns air

overload 1:
ViewerAPI.getActiveItem(): ItemStack
typings.-148280555
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the ticks this entity's active item has been used for

overload 1:
ViewerAPI.getActiveItemTime(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the remaining amount of air of the player

overload 1:
ViewerAPI.getAir(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the amount of armor points this entity has

overload 1:
ViewerAPI.getArmor(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the number of arrows sticking out of this entity

overload 1:
ViewerAPI.getArrowCount(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getBodyYaw(delta: Number): Number
typings.-1950496919typings.-1950496919
Method PropertyFluent DescriptionRepresentation
delta accepts
Return Value

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(): Vector3
typings.2002444080
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the delay (in ticks) of charged attacks

overload 1:
ViewerAPI.getChargedAttackDelay(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Return the vehicle that this entity is controlling

overload 1:
ViewerAPI.getControlledVehicle(): EntityAPI
typings.1263373079
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the entity that is controlling this entity

overload 1:
ViewerAPI.getControllingPassenger(): EntityAPI
typings.1263373079
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the whether a given ItemStack has an active cool down as a percent from 0.0 to 1.0
If it has none, it returns 0.0
Takes two parameters stack, and delta, delta offsets the cooldown's tick count by it, used for smoother animation.

overload 1:
ViewerAPI.getCooldownPercent(stack: ItemStack, delta: Number): Number
typings.-148280555typings.-1950496919typings.-1950496919
Method PropertyFluent DescriptionRepresentation
stack accepts
delta accepts
Return Value

Returns the number of ticks this entity has been dead for

overload 1:
ViewerAPI.getDeathTime(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the Minecraft identifier of the dimension this entity is in

overload 1:
ViewerAPI.getDimensionName(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the category of this entity
The categories are: "ARTHROPOD", "UNDEAD", "WATER", "ILLAGER" and by default, "UNDEFINED"

overload 1:
ViewerAPI.getEntityCategory(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the current exhaustion level of the player

overload 1:
ViewerAPI.getExhaustion(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the player's current level

overload 1:
ViewerAPI.getExperienceLevel(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the progress of the way towards the player's next level, as a value from 0 to 1

overload 1:
ViewerAPI.getExperienceProgress(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the current eye height of this entity

overload 1:
ViewerAPI.getEyeHeight(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the current food level of the player, from 0 to 20

overload 1:
ViewerAPI.getFood(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the number of ticks this entity has been freezing in powder snow for

overload 1:
ViewerAPI.getFrozenTicks(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Returns "SURVIVAL", "CREATIVE", "ADVENTURE", or "SPECTATOR" depending on the player's gamemode
If the gamemode is unknown, returns nil

overload 1:
ViewerAPI.getGamemode(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the amount of health this entity has remaining

overload 1:
ViewerAPI.getHealth(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

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(): ItemStack
typings.-148280555
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getHeldItem(offhand: Boolean): ItemStack
typings.1729365000typings.-148280555
Method PropertyFluent DescriptionRepresentation
offhand accepts
Return Value

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: Integer): ItemStack
typings.-672261858typings.-148280555
Method PropertyFluent DescriptionRepresentation
index accepts
Return Value

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(): Vector3
typings.2002444080
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the maximum amount of air this entity can have

overload 1:
ViewerAPI.getMaxAir(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the maximum amount of health this entity can have

overload 1:
ViewerAPI.getMaxHealth(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Returns "SLIM" or "DEFAULT", depending on the player's model type

overload 1:
ViewerAPI.getModelType(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

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(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Table
typings.80563118
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the closest entity to this entity
If `type` is an entity id, (e.g. `minecraft:bee`), only entities of that type will be considered
Radius defaults to 20, and controls the size of the area for checking entities as a box expanding in every direction from the player

overload 1:
ViewerAPI.getNearestEntity(type: String, radius: Number): EntityAPI
typings.-1808118735typings.-1950496919typings.1263373079
Method PropertyFluent DescriptionRepresentation
type accepts
radius accepts
Return Value
overload 2:
ViewerAPI.getNearestEntity(type: String): EntityAPI
typings.-1808118735typings.1263373079
Method PropertyFluent DescriptionRepresentation
type accepts
Return Value
overload 3:
ViewerAPI.getNearestEntity(): EntityAPI
typings.1263373079
Method PropertyFluent DescriptionRepresentation
Return Value

Returns a List of entities of all passengers this entity has

overload 1:
ViewerAPI.getPassengers(): Table
typings.80563118
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the permission level number of this entity
Server Operators, by default, have the permission level of 4

overload 1:
ViewerAPI.getPermissionLevel(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Vector3
typings.2002444080
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getPos(delta: Number): Vector3
typings.-1950496919typings.2002444080
Method PropertyFluent DescriptionRepresentation
delta accepts
Return Value

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(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the current reach distance of the player

overload 1:
ViewerAPI.getReachDistance(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Vector2
typings.2002444079
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getRot(delta: Number): Vector2
typings.-1950496919typings.2002444079
Method PropertyFluent DescriptionRepresentation
delta accepts
Return Value

Gets the current saturation level of the player

overload 1:
ViewerAPI.getSaturation(): Number
typings.-1950496919
Method PropertyFluent DescriptionRepresentation
Return Value

Returns a table of the nbt of this entity left or right shoulder entity

overload 1:
ViewerAPI.getShoulderEntity(): Table
typings.80563118
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getShoulderEntity(right: Boolean): Table
typings.1729365000typings.80563118
Method PropertyFluent DescriptionRepresentation
right accepts
Return Value

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(): Table
typings.80563118
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the number of bee stingers sticking out of this entity

overload 1:
ViewerAPI.getStingerCount(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Returns "OFF_HAND" or "MAIN_HAND", based on the arm this entity is currently swinging

overload 1:
ViewerAPI.getSwingArm(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the number of ticks this entity will have while swinging its arms

overload 1:
ViewerAPI.getSwingDuration(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

Returns the number of ticks this entity has the arm swinging

overload 1:
ViewerAPI.getSwingTime(): Integer
typings.-672261858
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Varargs
typings.1901216868
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getTargetedBlock(ignoreLiquids: Boolean): Varargs
typings.1729365000typings.1901216868
Method PropertyFluent DescriptionRepresentation
ignoreLiquids accepts
Return Value
overload 3:
ViewerAPI.getTargetedBlock(ignoreLiquids: Boolean, distance: Number): Varargs
typings.1729365000typings.-1950496919typings.1901216868
Method PropertyFluent DescriptionRepresentation
ignoreLiquids accepts
distance accepts
Return Value

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(): Varargs
typings.1901216868
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getTargetedEntity(distance: Number): Varargs
typings.-1950496919typings.1901216868
Method PropertyFluent DescriptionRepresentation
distance accepts
Return Value

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(): Table
typings.80563118
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the Minecraft identifier of this entity
For instance, "minecraft:pig"

overload 1:
ViewerAPI.getType(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the UUID of the proxied entity

overload 1:
ViewerAPI.getUUID(): String
typings.-1808118735
Method PropertyFluent DescriptionRepresentation
Return Value

Gets the value of a variable this entity stored in themselves using the Avatar API's store() function

overload 1:
ViewerAPI.getVariable(): AnyType
typings.821772070
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.getVariable(key: String): AnyType
typings.-1808118735typings.821772070
Method PropertyFluent DescriptionRepresentation
key accepts
Return Value

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(): EntityAPI
typings.1263373079
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Vector3
typings.2002444080
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if Figura has an avatar loaded for this entity

overload 1:
ViewerAPI.hasAvatar(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns whether the player has a cape loaded

overload 1:
ViewerAPI.hasCape(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Checks if the entity has a container (Chest Boats, Minecarts with Chests, …)

overload 1:
ViewerAPI.hasContainer(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Checks if the entity has an inventory (Horses, Camels, LLamas, …)

overload 1:
ViewerAPI.hasInventory(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns whether the player has a custom skin loaded

overload 1:
ViewerAPI.hasSkin(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns whether this entity is alive or not

overload 1:
ViewerAPI.isAlive(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Return if this entity is blocking with a shield

overload 1:
ViewerAPI.isBlocking(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if the entity is currently using a climbable block, like a ladder or vine

overload 1:
ViewerAPI.isClimbing(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is visually sneaking

overload 1:
ViewerAPI.isCrouching(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity has negative Y-velocity and is not on the ground

overload 1:
ViewerAPI.isFalling(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns if the player is currently fishing

overload 1:
ViewerAPI.isFishing(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Checks if the player is currently flying

overload 1:
ViewerAPI.isFlying(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns if this entity is gliding with an elytra

overload 1:
ViewerAPI.isGliding(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is currently glowing

overload 1:
ViewerAPI.isGlowing(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is currently in lava

overload 1:
ViewerAPI.isInLava(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is currently standing in rain

overload 1:
ViewerAPI.isInRain(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is currently in a water block, including waterlogging

overload 1:
ViewerAPI.isInWater(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is invisible, for one reason or another

overload 1:
ViewerAPI.isInvisible(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Checks if the player is jumping
Note this is only true during the first tick the player started jumping

overload 1:
ViewerAPI.isJumping(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if the entity's main hand is its left

overload 1:
ViewerAPI.isLeftHanded(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Gets if this entity is a Living Entity

overload 1:
ViewerAPI.isLiving(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity has some velocity
Takes a boolean parameter, where if true, the y velocity is ignored

overload 1:
ViewerAPI.isMoving(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value
overload 2:
ViewerAPI.isMoving(ignoreY: Boolean): Boolean
typings.1729365000typings.1729365000
Method PropertyFluent DescriptionRepresentation
ignoreY accepts
Return Value

Returns true if this entity is currently on fire

overload 1:
ViewerAPI.isOnFire(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns whether or not this entity is currently on the ground

overload 1:
ViewerAPI.isOnGround(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Gets if this entity is a Player Entity

overload 1:
ViewerAPI.isPlayer(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns if this entity takes damage to water

overload 1:
ViewerAPI.isSensitiveToWater(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is silent

overload 1:
ViewerAPI.isSilent(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns whether the specified skin layer, from the Skin Customizations settings, is currently visible

overload 1:
ViewerAPI.isSkinLayerVisible(part: String): Boolean
typings.-1808118735typings.1729365000
Method PropertyFluent DescriptionRepresentation
part accepts
Return Value

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(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity is currently sprinting

overload 1:
ViewerAPI.isSprinting(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if the entity is currently swinging its arm

overload 1:
ViewerAPI.isSwingingArm(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if this entity's eyes are touching water

overload 1:
ViewerAPI.isUnderwater(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns true if the entity is currently using an item

overload 1:
ViewerAPI.isUsingItem(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns if this entity has the swimming pose

overload 1:
ViewerAPI.isVisuallySwimming(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

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(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value

Returns if this entity is riptide spinning

overload 1:
ViewerAPI.riptideSpinning(): Boolean
typings.1729365000
Method PropertyFluent DescriptionRepresentation
Return Value