Introduction
What is Koremods
Koremods is a Kotlin Script bytecode manipulation framework. Its goal is to provide a simple and sandboxed environment for runtime transformation of JVM classes.
Features
- 📦 Sandboxed
- Koremods scripts are executed in an isolated environment to ensure they only access necessary classes and resources
- ⚡ Focused
- Using the ASM Kotlin wrapper Koffee, you can focus on writing transformers without needless boilerplate code
- ☁ Lightweight Runtime
- Near-instant evaluation speeds of scripts pre-compiled by the Koremods Gradle plugin
- 🧩 Portable
- Koremods' feature-rich core allows easy compatibility with your desired platform
- Frontends only need to create a thin layer beween the platform and Koremods Script.
Availability
Currently, the primary frontend is Koremods-Modlauncher, which targets Modlauncher, MinecraftForge's associated library for "launching Java programs with in-flight transformation ability".
Kotlin Script
Kotlin Scripting is a new, experimental technology that lets you run Kotlin code without prior compilation or packaging. All of Kotlin's language features are available, usually with the addition of a speficic DSL provided by the script definition. Scripts are compiled into bytecode at runtime, and then loaded into the JVM using a custom classloader.
Scripts can also provide various refinements and preprocessing, such as depending on remote maven libraries,
importing other scripts, customizing per-file compilation options and more.
For example:
@file:DependsOn("maven:artifact:1.0") // Depend on a maven artifact from a remote repository
@file:Import("path/to/externalScript.kts") // Access classes, properties and functions from other scripts
@file:CompilerOptions("-someCompilerOpt") // Customize script compilation options
Some of these refinements may not be available in Koremods