Skip to content

BlockState

A BlockSate is extra data associated with a block used to determine how a block looks and behaves. The API only exposes the NovaMaterial and the location of the block via the NovaBlockState class.

Getting the NovaMaterial of a block at a specific location

val blockState = blockManager.getBlock(location) ?: return
val material = blockState.material
val location = blockState.location
NovaBlockState blockState = blockManager.getBlock(location);
if (blockState == null)
    return;
NovaMaterial material = blockState.getMaterial();
Location location = blockState.getLocation();

TileEntity block states

TileEntities use the NovaTileEntityState class via which you can get the TileEntity instance of the block.

val blockState = blockManager.getBlock(location) ?: return
if (blockState is NovaTileEntityState) {
    val tileEntity = blockState.tileEntity
}
NovaBlockState blockState = blockManager.getBlock(location);
if (blockState == null)
    return;
if (blockState instanceof NovaTileEntityState tileEntityState) {
    TileEntity tileEntity = tileEntityState.getTileEntity();
}

For more information about the BlockManager, see the BlockManager page.