Skip to content
On this page

Common

Block

top.katton.api.registrycommon/src/main/kotlin/top/katton/api/registry/Block.kt
Registers a native Block with hot-reload support (String overload).

registerNativeBlock

CommonFunction
kotlin
@ApiStatus.Experimental
@ApiStatus.Experimental fun registerNativeBlock(id: String, registerMode: RegisterMode = RegisterMode.AUTO, blockFactory: (BlockBehaviour.Properties) -> Block): KattonRegistry.KattonBlockEntry

Registers a native Block with hot-reload support (String overload).

This is the primary API for registering custom Block subclasses from scripts. The block will be registered in the global Minecraft registry with full hot-reload capability.

Parameters

ParameterDescription
idBlock identifier (e.g., "mymod:custom_block")
registerModeRegistration mode (GLOBAL, RELOADABLE, or AUTO)
blockFactoryFactory function to create the Block instance, receives Properties

Returns

The registered KattonBlockEntry

registerNativeBlock

CommonFunction
kotlin
@ApiStatus.Experimental
@ApiStatus.Experimental fun registerNativeBlock(id: Identifier, registerMode: RegisterMode = RegisterMode.AUTO, blockFactory: (BlockBehaviour.Properties) -> Block): KattonRegistry.KattonBlockEntry

Registers a native Block with hot-reload support (Identifier overload).

Parameters

ParameterDescription
idBlock identifier
registerModeRegistration mode
blockFactoryFactory function to create the Block instance

Returns

The registered KattonBlockEntry

createSimpleBlock

CommonFunction
kotlin
fun createSimpleBlock(properties: BlockBehaviour.Properties = BlockBehaviour.Properties.of()): Block

Utility factory for quickly creating a simple custom block.

Creates a basic Block with the specified properties. For more complex blocks, use the full factory pattern with registerNativeBlock.

Parameters

ParameterDescription
propertiesBlock behavior properties (default: basic properties)

Returns

A new Block instance