KotlinLangForge Mod brings a Kotlin language adapter and 13 bundled libraries to Forge and NeoForge. This mod runs in the background as a required dependency so other mods written in Kotlin can load and work properly. It also handles automatic event listener registration, gives direct access to the mod event bus, and supports Kotlin objects or classes as mod entry points. On its own, the mod does not add any new content to Minecraft.

Features:

  • Adds a Kotlin language adapter so Forge and NeoForge can load mods written in Kotlin.
  • Runs in the background as a required dependency without adding any new in-game content on its own.
  • Supports @Mod classes written as a Kotlin object or as a class with a public constructor.
  • Lets the @Mod constructor take up to four non-duplicate arguments: IEventBus, ModContainer, KotlinModContainer, and Dist.
  • Registers event listeners automatically when @EventBusSubscriber is placed on a class or file, finding methods with event parameters and choosing the right event bus.
  • Supports @SubscribeEvent on methods to adjust listener parameters, while private event listeners cannot run on Forge and cause a crash.
  • Gives top-level access to the mod event bus through dev.nyon.klf.MOD_BUS.
  • Uses its own language provider version format to separate different adapter builds across Minecraft versions on Forge and NeoForge.

Included Libraries:

  • org.jetbrains.kotlin:kotlin-stdlib:2.4.21
  • org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.4.21
  • org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.4.21
  • org.jetbrains.kotlin:kotlin-reflect:2.4.21
  • org.jetbrains.kotlinx:kotlinx-serialization-core:1.13.0
  • org.jetbrains.kotlinx:kotlinx-serialization-json:1.13.0
  • org.jetbrains.kotlinx:kotlinx-serialization-cbor:1.13.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-core:1.11.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.11.0
  • org.jetbrains.kotlinx:kotlinx-datetime:0.8.0-0.6.x-compat
  • org.jetbrains.kotlinx:kotlinx-io-core:0.9.3
  • org.jetbrains.kotlinx:kotlinx-io-bytestring:0.9.3
  • org.jetbrains.kotlinx:atomicfu:0.33.0

Configuration:

Add these two lines to your mods.toml or neoforge.mods.toml file to turn on the Kotlin language adapter:

  • modLoader = "klf": Sets this mod as the language loader.
  • loaderVersion = "[1,)": Sets the accepted loader version range.
modLoader = "klf"
loaderVersion = "[1,)"

To use the bundled Kotlin libraries in a mod project, add the repository and dependency to build.gradle.kts. Use modImplementation instead of implementation when the language provider version is 3.0 or lower:

repositories {
    maven("https://repo.nyon.dev/releases")
}

dependencies {
    implementation("dev.nyon:KotlinLangForge:2.20.0-k2.4.21-$lpVersion+$loader")
}

Replace $lpVersion and $loader with the matching values from the table below:

Minecraft Version Language Provider Version Supported Loaders
1.16.5 1.0 Forge
1.17.1 – 1.20.4 2.0 Forge, NeoForge
1.20.5 – 1.21.8 3.0 NeoForge
1.21.9 – 26.x 3.1 NeoForge

How to Use:

  1. Add modLoader = "klf" and loaderVersion = "[1,)" to your mods.toml or neoforge.mods.toml file so Forge or NeoForge loads your mod with the Kotlin adapter.
  2. Write your @Mod entry class as a Kotlin object or a class with a public constructor, and pass any non-duplicate mix of IEventBus, ModContainer, KotlinModContainer, and Dist when needed.
  3. Add the Maven repository and dependency to build.gradle.kts with the matching language provider version and loader (use modImplementation for version 3.0 or lower) so the bundled Kotlin libraries are ready in your project.
  4. Place @EventBusSubscriber on a class or file to turn on automatic event listener registration; the adapter finds methods with event parameters and picks the right event bus.
  5. Add @SubscribeEvent to a method when you want to adjust listener parameters, and keep event listeners non-private on Forge so the game does not crash.
  6. Use the top-level dev.nyon.klf.MOD_BUS declaration whenever you need direct access to the mod event bus.

Screenshots:

Bright sunlight shining over a large Minecraft mountain with trees
Sunlight illuminates massive mountain peaks in a world running KotlinLangForge libraries
Hilly landscape covered in trees with fog and bright light
Morning mist blankets forested hills inside a stable KotlinLangForge modded environment
Minecraft landscape with tall trees on rocky hills
Tall forest trees grow across rocky ridges loaded with KotlinLangForge dependencies
River flowing between rocky hills with trees
A clear river winds through steep cliffs during KotlinLangForge addon testing
Realistic water surface with reflections and shader effects
Sunlight reflects across detailed water surfaces in a KotlinLangForge modded game

KotlinLangForge Mod Download Links

Filter by

For Minecraft 26.3, 26.2, 26.1.2

For Minecraft 26.2, 1.21.11

For Minecraft 26.1.2, 26.1.1, 26.1

For Minecraft 1.21.11, 1.21.8, 1.21.7

For Minecraft 1.21.5

NeoForge 7 MB

For Minecraft 1.21.4, 1.20.6

NeoForge 7 MB

For Minecraft 1.20.4, 1.20.3, 1.20.2

For Minecraft 1.16.5

Click to rate this post!
[Total: 3 Average: 2.3]