Function Compiler
The Function Compiler mod dramatically speeds up Minecraft server performance by converting datapack functions into Java bytecode. Instead of executing commands sequentially as in the standard process, compiled code runs all operations simultaneously, significantly improving performance.
When using the mod, statistics are automatically collected: execution time, function count, instruction count, as well as possible errors and crashes (which may contain commands for debugging). To enhance speed, the mod ignores the maxCommandChainLength game rule since constantly checking the number of executed commands could slow down the process.
How to Use
Simply install the mod on a Fabric server along with the necessary dependencies. Function Compiler will automatically optimize all supported functions and commands. In case of crashes, they will be automatically recorded.
Supported Commands
The mod does not support all Minecraft commands—it generates code only for functions containing exclusively compatible commands. Currently, not all functions with macros can be compiled, as some values are interpreted in various ways, which is difficult to implement at compile time.
Selectors
All selectors and their parameters are supported without exceptions.
How It Works
Function Compiler uses Java's class loader: during runtime, bytecode is generated for functions, which is then loaded and executed. This allows for maximum efficiency when working with datapacks.