Fabric-language: Kotlin
Note: The fabric-language-kotlin module registers the kotlin language adapter automatically. Block with simple properties object ModBlocks val EXAMPLE_BLOCK: Block = Block(FabricBlockSettings.create() .strength(4.0f) .requiresTool() .mapColor(MapColor.STONE_GRAY)) fun register() Registry.register(Registries.BLOCK, Identifier(MOD_ID, "example_block"), EXAMPLE_BLOCK)
In gradle.properties :
Kotlin makes Fabric modding more expressive and safer. Start with a simple item/block, then gradually adopt coroutines and extensions as you get comfortable. fabric-language kotlin
suspend fun fetchData(): String = withContext(Dispatchers.IO) // network call fabric-language kotlin
package com.example.mymod import net.fabricmc.api.ModInitializer import org.slf4j.LoggerFactory fabric-language kotlin