Skip to content
On this page
Common

KattonBlockModificationApi

top.katton.api.modcommon/src/main/kotlin/top/katton/api/mod/KattonBlockModificationApi.kt
Configuration for modifying existing block properties.

BlockModificationConfig ​

BlockModificationConfigCommonClass
kotlin
class BlockModificationConfig( val blockId: Identifier )

Configuration for modifying existing block properties.

This class provides a fluent API for modifying properties of existing blocks registered in Minecraft's block registry. Similar to KubeJS's block modification system.

Properties ​

PropertyDescription
blockIdThe identifier of the block to modify

modifyBlock ​

modifyBlockCommonFunction
kotlin
@ApiStatus.Experimental
@ApiStatus.Experimental fun modifyBlock(blockId: String, configure: BlockModificationConfig.() -> Unit): Block

Modifies an existing block's properties.

This function allows you to modify properties of blocks already registered in Minecraft's block registry. Changes are applied to the block's default state and will affect all instances of that block.

Parameters ​

ParameterDescription
blockIdThe identifier of the block to modify (e.g., "minecraft:stone")
configureConfiguration lambda for block modifications

Returns ​

modified Block instance

modifyBlock ​

modifyBlockCommonFunction
kotlin
@ApiStatus.Experimental
@ApiStatus.Experimental fun modifyBlock(blockId: Identifier, configure: BlockModificationConfig.() -> Unit): Block

Modifies an existing block's properties.

Parameters ​

ParameterDescription
blockIdThe identifier of the block to modify
configureConfiguration lambda for block modifications

Returns ​

modified Block instance

getBlock ​

getBlockCommonFunction
kotlin
fun getBlock(blockId: String): Block?

Gets a block by its identifier.

Parameters ​

ParameterDescription
blockIdThe block identifier

Returns ​

Block instance, or null if not found

getBlock ​

getBlockCommonFunction
kotlin
fun getBlock(blockId: Identifier): Block?

Gets a block by its identifier.

Parameters ​

ParameterDescription
blockIdThe block identifier

Returns ​

Block instance, or null if not found

getBlockState ​

getBlockStateCommonFunction
kotlin
fun getBlockState(blockId: String): BlockState?

Gets the default block state for a block.

Parameters ​

ParameterDescription
blockIdThe block identifier

Returns ​

default BlockState, or null if block not found

getBlockState ​

getBlockStateCommonFunction
kotlin
fun getBlockState(blockId: Identifier): BlockState?

Gets the default block state for a block.

Parameters ​

ParameterDescription
blockIdThe block identifier

Returns ​

default BlockState, or null if block not found