KotlinLangForge Mod 1.17.1–26.3

MOD

KotlinLangForge provides a Kotlin language adapter for Forge and Neoforge, also supplying multiple libraries. Its specific purpose is to allow mod developers to use Kotlin for their projects. To integrate the language adapter into a mod, lines must be added to the (neoforge.)mods.toml file. Mod initialization requires the main class to be either an object or a class with a public constructor. This constructor can accept IEventBus, ModContainer, KotlinModContainer, and Dist as arguments, which should not be duplicated.

KotlinLangForge provides a Kotlin language adapter for Forge and Neoforge, also supplying multiple libraries. Its specific purpose is to allow mod developers to use Kotlin for their projects. To integrate the language adapter into a mod, lines must be added to the (neoforge.)mods.toml file. Mod initialization requires the main class to be either an object or a class with a public constructor. This constructor can accept IEventBus, ModContainer, KotlinModContainer, and Dist as arguments, which should not be duplicated.

Implementing the included libraries necessitates importing a dependency that matches the language provider version, the loader, and the Kotlin version. The "language provider version" is a specific versioning scheme used only by KotlinLangForge to differentiate its implementations across Minecraft versions. For automatic event listener registration, an annotation must be added to the class or file, allowing KotlinLangForge to automatically identify methods with event parameters and determine the correct event bus. Additionally, a method can be annotated to adjust listener parameters. For Forge developers, private event listeners are not supported and will cause a crash. The mod bus is accessible via the top-level declaration.