Skip to main content

BlockState

A proxy for a block state from Minecraft

warning

This page is a WIP. It contains all the information in Figura's documentation but we're working on adding more helpful descriptions.

Instances are obtained through the WorldAPI

This proxy also contains a saved position for the BlockState

For all exmaples on this page assume:

local block = world.getBlockState(player:getPos():sub(0, 0.5, 0))

Redstone Properties

getComparatorOutput()

Gets the amount of signal strength a comparator would get from this BlockState

getComparatorOutput()

Returns:

TypeDescription
Integer-

Example:

block:getComparatorOutput()

emitsRedstonePower()

Gets whether or not this BlockState emits redstone power

emitsRedstonePower()

Returns:

TypeDescription
Boolean-

Example:

block:emitsRedstonePower()

Player Effects

getJumpVelocityMultiplier()

Gets the jump velocity multiplier of this BlockState

(Literally just honey blocks in vanilla)

getJumpVelocityMultiplier()

Returns:

TypeDescription
Number-

Example:

block:getJumpVelocityMultiplier()

getVelocityMultiplier()

Gets the velocity multiplier of this BlockState

(Only Soul sand, honey blocks in vanilla)

getVelocityMultiplier()

Returns:

TypeDescription
Number-

Example:

block:getVelocityMultiplier()

Shape

getCollisionShape()

Returns a table representing the bounding boxes of the collision shape

The table a list of every shape, containing two Vector3, where the first vector is one corner of the box and the other vector is the other corner

getCollisionShape()

Returns:

TypeDescription
Table-

Example:

block:getCollisionShape()

getOutlineShape()

Returns a table representing the bounding boxes of the outline shape

The table a list of every shape, containing two Vector3, where the first vector is one corner of the box and the other vector is the other corner

getOutlineShape()

Returns:

TypeDescription
Table-

Example:

block:getOutlineShape()

Visual Properties

getLuminance()

Gets the emission light level of this BlockState

getLuminance()

Returns:

TypeDescription
Integer-

Example:

block:getLuminance()

getMapColor()

Gets the map color of this BlockState, as a Vector3 with R,G,B ranging 0 to 1

getMapColor()

Returns:

TypeDescription
Vector3-

Example:

block:getMapColor()

getOpacity()

Gets the opacity of the BlockState, in terms of how much it affects light levels

getOpacity()

Returns:

TypeDescription
Integer-

Example:

block:getOpacity()

getTextures()

Returns a List of this BlockState's textures

The keys represents the Culling Direction, while the values is another table with all texture paths (string)

Note this only works for normal blocks, special blocks (water, beds, …) will return an empty table

getTextures()

Returns:

TypeDescription
Table-

Example:

block:getTextures()

hasEmissiveLighting()

Gets whether or not the BlockState uses emissive lighting

hasEmissiveLighting()

Returns:

TypeDescription
Boolean-

Example:

block:hasEmissiveLighting()

Physical Properties

getBlastResistance()

Gets the blast resistance of this BlockState

getBlastResistance()

Returns:

TypeDescription
Number-

Example:

block:getBlastResistance()

getFriction()

Gets the friction of this BlockState

(Slime blocks and ice in vanilla)

getFriction()

Returns:

TypeDescription
Number-

Example:

block:getFriction()

getHardness()

Gets the hardness of the BlockState

getHardness()

Returns:

TypeDescription
Number-

Example:

block:getHardness()

hasCollision()

Returns true if this block has collision

hasCollision()

Returns:

TypeDescription
Boolean-

Example:

block:hasCollision()

isAir()

Checks if this block is air

isAir()

Returns:

TypeDescription
Boolean-

Example:

block:isAir()

isFullCube()

Gets whether or not the BlockState has a full cube as its collision hitbox

isFullCube()

Returns:

TypeDescription
Boolean-

Example:

block:isFullCube()

isOpaque()

Gets whether or not this BlockState is opaque

isOpaque()

Returns:

TypeDescription
Boolean-

Example:

block:isOpaque()

isSolidBlock()

Gets whether or not the BlockState is considered a "solid" block by Minecraft

isSolidBlock()

Returns:

TypeDescription
Boolean-

Example:

block:isSolidBlock()

isTranslucent()

Gets whether or not the BlockState would propagate sky light downwards

isTranslucent()

Returns:

TypeDescription
Boolean-

Example:

block:isTranslucent()

Misc

getEntityData()

Returns the nbt of the Block Entity associated with this BlockState, at its position, as a table

Since the mod is only on client side, this NBT might not actually contain the real nbt, which is stored server-side

getEntityData()

Returns:

TypeDescription
Table-

Example:

block:getEntityData()

getFluidTags()

Returns a table containing all the fluid tags of this block, as strings

getFluidTags()

Returns:

TypeDescription
Table-

Example:

block:getFluidTags()

getID()

Returns this BlockState identifier

getID()

Returns:

TypeDescription
String-

Example:

block:getID()

setPos()

Aliases: pos()

Sets the saved position for this BlockState proxy

The saved position is used in BlockState functions that require a position

setPos(pos)

Parameters:

NameTypeDescriptionDefault
posVector3--

Returns:

TypeDescription
BlockStateReturns self for chaining

Example:

block:setPos(player:getPos())

getPos()

Returns the saved position for this BlockState proxy

The saved position is used in BlockState functions that require a position

getPos()

Returns:

TypeDescription
Vector3-

Example:

block:getPos()

getProperties()

Returns a table with the properties of this BlockState

getProperties()

Returns:

TypeDescription
Table-

Example:

block:getProperties()

getSounds()

Gets the names of all the sounds which can play from this BlockState, as well as their pitch and volume

Stored in a table

getSounds()

Returns:

TypeDescription
Table-

Example:

block:getSounds()

getTags()

Returns a table containing all the tags of this block, as strings

getTags()

Returns:

TypeDescription
Table-

Example:

block:getTags()

asItem()

Returns an ItemStack representing this block in item form, whatever Minecraft deems that to be

If it cannot find an item for this block, it will return nil

asItem()

Returns:

TypeDescription
ItemStack-

Example:

block:asItem()

hasBlockEntity()

Gets whether or not this BlockState has an associated block entity

hasBlockEntity()

Returns:

TypeDescription
Boolean-

Example:

block:hasBlockEntity()

toStateString()

Converts this BlockState into a string, like you'd see in a Minecraft command

toStateString()

Returns:

TypeDescription
String-

Example:

block:toStateString()

Fields

id

The identifier of the block this BlockState comes from

Example:

block.id

properties

A table containing the properties of this BlockState

If this BlockState has no properties, it is nil

Example:

block.properties