For Fabric [exclusive]: Kotlin
In this post, we’ll explore why Kotlin is gaining traction in the Fabric community, how to set it up, and which features will make you never want to touch Java for modding again. Fabric is lightweight, modular, and fast. Kotlin complements this perfectly. Here is what you gain:
dependencies modImplementation("net.fabricmc:fabric-loader:0.14.24") modImplementation("net.fabricmc.fabric-api:fabric-api:0.91.0+1.20.4") kotlin for fabric
@Serializable data class EnergyComponent(var amount: Int, val max: Int) // Instantiate val battery = EnergyComponent(100, 500) val copy = battery.copy(amount = 200) // Immutable copy with change Need to run code after 5 seconds without blocking the game thread? In this post, we’ll explore why Kotlin is
fun BlockView.isSkyExposed(pos: BlockPos): Boolean return getLightLevel(pos) >= 15 && !isRainOccluded(pos) In this post