BlockState
A proxy for a block state from Minecraft
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:
Type | Description |
---|---|
Integer | - |
Example:
block:getComparatorOutput()
emitsRedstonePower()
Gets whether or not this BlockState emits redstone power
emitsRedstonePower()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:emitsRedstonePower()
Player Effects
getJumpVelocityMultiplier()
Gets the jump velocity multiplier of this BlockState
(Literally just honey blocks in vanilla)
getJumpVelocityMultiplier()
Returns:
Type | Description |
---|---|
Number | - |
Example:
block:getJumpVelocityMultiplier()
getVelocityMultiplier()
Gets the velocity multiplier of this BlockState
(Only Soul sand, honey blocks in vanilla)
getVelocityMultiplier()
Returns:
Type | Description |
---|---|
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:
Type | Description |
---|---|
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:
Type | Description |
---|---|
Table | - |
Example:
block:getOutlineShape()
Visual Properties
getLuminance()
Gets the emission light level of this BlockState
getLuminance()
Returns:
Type | Description |
---|---|
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:
Type | Description |
---|---|
Vector3 | - |
Example:
block:getMapColor()
getOpacity()
Gets the opacity of the BlockState, in terms of how much it affects light levels
getOpacity()
Returns:
Type | Description |
---|---|
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:
Type | Description |
---|---|
Table | - |
Example:
block:getTextures()
hasEmissiveLighting()
Gets whether or not the BlockState uses emissive lighting
hasEmissiveLighting()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:hasEmissiveLighting()
Physical Properties
getBlastResistance()
Gets the blast resistance of this BlockState
getBlastResistance()
Returns:
Type | Description |
---|---|
Number | - |
Example:
block:getBlastResistance()
getFriction()
Gets the friction of this BlockState
(Slime blocks and ice in vanilla)
getFriction()
Returns:
Type | Description |
---|---|
Number | - |
Example:
block:getFriction()
getHardness()
Gets the hardness of the BlockState
getHardness()
Returns:
Type | Description |
---|---|
Number | - |
Example:
block:getHardness()
hasCollision()
Returns true if this block has collision
hasCollision()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:hasCollision()
isAir()
Checks if this block is air
isAir()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:isAir()
isFullCube()
Gets whether or not the BlockState has a full cube as its collision hitbox
isFullCube()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:isFullCube()
isOpaque()
Gets whether or not this BlockState is opaque
isOpaque()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:isOpaque()
isSolidBlock()
Gets whether or not the BlockState is considered a "solid" block by Minecraft
isSolidBlock()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:isSolidBlock()
isTranslucent()
Gets whether or not the BlockState would propagate sky light downwards
isTranslucent()
Returns:
Type | Description |
---|---|
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:
Type | Description |
---|---|
Table | - |
Example:
block:getEntityData()
getFluidTags()
Returns a table containing all the fluid tags of this block, as strings
getFluidTags()
Returns:
Type | Description |
---|---|
Table | - |
Example:
block:getFluidTags()
getID()
Returns this BlockState identifier
getID()
Returns:
Type | Description |
---|---|
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
- Overload 1
- Overload 2
setPos(pos)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pos | Vector3 | - | - |
Returns:
Type | Description |
---|---|
BlockState | Returns self for chaining |
setPos(x, y, z)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x | Number | - | - |
y | Number | - | - |
z | Number | - | - |
Returns:
Type | Description |
---|---|
BlockState | Returns 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:
Type | Description |
---|---|
Vector3 | - |
Example:
block:getPos()
getProperties()
Returns a table with the properties of this BlockState
getProperties()
Returns:
Type | Description |
---|---|
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:
Type | Description |
---|---|
Table | - |
Example:
block:getSounds()
getTags()
Returns a table containing all the tags of this block, as strings
getTags()
Returns:
Type | Description |
---|---|
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:
Type | Description |
---|---|
ItemStack | - |
Example:
block:asItem()
hasBlockEntity()
Gets whether or not this BlockState has an associated block entity
hasBlockEntity()
Returns:
Type | Description |
---|---|
Boolean | - |
Example:
block:hasBlockEntity()
toStateString()
Converts this BlockState into a string, like you'd see in a Minecraft command
toStateString()
Returns:
Type | Description |
---|---|
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