Fabric-language | Kotlin ((link))
package com.example.mymod import net.fabricmc.api.ModInitializer import org.slf4j.LoggerFactory
@Mixin(PlayerEntity::class) abstract class PlayerMixin @ModifyVariable(method = "attack", at = @At("HEAD")) fun modifyAttackDamage(damage: Float): Float return damage * 1.5f fabric-language kotlin
Update fabric.mod.json :
Call in onInitialize :
// Kotlin modImplementation "net.fabricmc:fabric-language-kotlin:$project.fabric_kotlin_version" include "net.fabricmc:fabric-language-kotlin:$project.fabric_kotlin_version" package com
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
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)
