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

CommonClass
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

CommonFunction
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

The modified Block instance

modifyBlock

CommonFunction
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

The modified Block instance

getBlock

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

Gets a block by its identifier.

Parameters

ParameterDescription
blockIdThe block identifier

Returns

The Block instance, or null if not found

getBlock

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

Gets a block by its identifier.

Parameters

ParameterDescription
blockIdThe block identifier

Returns

The Block instance, or null if not found

getBlockState

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

Gets the default block state for a block.

Parameters

ParameterDescription
blockIdThe block identifier

Returns

The default BlockState, or null if block not found

getBlockState

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

Gets the default block state for a block.

Parameters

ParameterDescription
blockIdThe block identifier

Returns

The default BlockState, or null if block not found