Function Compiler

Function Compiler

This mod allows the server to automatically compile most of the functions to Java bytecode

by
10.6K Downloads
fabricquiltoptimization
Rent Server with this Mod

About this Mod

This mod has only been updated up to 1.21.4, because 1.21.5 completely changed the SNBT parser and accessing, which made me slightly less motivated to work on this project. (perhaps 26.1)

Function Compiler

This mod allows the server to compile functions from datapacks on load to Java bytecode, which results in increased performance, because compiled code can run everything at once instead of running commands one by one.

Some statistics are automatically collected when using this mod. Feel free to check the code to check what is reported, but the main things are: timings, function counts, instruction counts, exceptions/crashes (those might contain the commands for debugging).

This mod will not respect the maxCommandChainLength gamerule to improve performance, otherwise it would require the compiled code to check the amount of commands ran, which could be slow.

Usage

Put the mod on a fabric server with all the dependencies, the mod will automatically try to optimize all functions and commands which are supported.

If you encounter any crashes, they will be automatically reported. If you have more context to how to trigger a crash, please report it on the issue tracker.

Supported Commands

Of course this mod can't support every command, so it will only generate code for functions which contain only commands which are supported. Currently, this will not compile every function with macros. It can't compile some macros because any value could be interpreted in any way, which is hard to implement using only things known at compile-time, but some things could be guessed.

The list of commands supported currently as of 0.3.2-alpha.2 can be found in the Command Support file.

Supported Selectors

All the selectors are supported, and all their options.

How it works

This mod works by using Java's class loader: It generates bytecode for the functions at runtime and loads them. If you'd like you can always look at the source here.

Available Versions

Function Compiler 0.3.2-alpha.2 [1.21.4]alpha
MC 1.21.4fabric, quilt
March 16, 2025
Function Compiler 0.3.2-alpha.2 [1.21.2-1.21.3]alpha
MC 1.21.2, 1.21.3fabric, quilt
March 16, 2025
Function Compiler 0.3.2-alpha.2 [1.21-1.21.1]alpha
MC 1.21, 1.21.1fabric, quilt
March 16, 2025
Function Compiler 0.3.2-alpha.2 [1.20.5-1.20.6]alpha
MC 1.20.5, 1.20.6fabric, quilt
March 16, 2025
Function Compiler 0.3.2-alpha.2 [1.20.3-1.20.4]alpha
MC 1.20.3, 1.20.4fabric, quilt
March 16, 2025

How to Install Function Compiler on Your Server

1

Order Server

Order a Minecraft Java server with at least 3 GB RAM (4 GB recommended).

2

Set fabric Loader

In the panel under "Egg", select the fabric loader and matching Minecraft version (1.21.4).

3

Install Mod

Open the mod browser in the dashboard and search for "Function Compiler". Click "Install" – done! Alternatively, upload the .jar via SFTP to the /mods folder.

Compatibility

Mod Loaders

fabricquilt

Minecraft Versions

1.21.4, 1.21.3, 1.21.2 (+10 more)

Server-side

Required

Recommended RAM

4 GB(min. 3 GB)

Frequently Asked Questions

Function Compiler server crashes on startup – what to do?

Most common cause: wrong fabric version or insufficient RAM. Check the server log (latest.log) for "OutOfMemoryError" or "Mixin" errors. With Mado Hosting: ensure at least 3 GB RAM is allocated and the loader matches the mod version (1.21.4). You can switch loaders with one click in the panel.

Is Function Compiler compatible with fabric and quilt?

Function Compiler officially supports fabric, quilt for Minecraft 1.21.4, 1.21.3, 1.21.2. The Mado dashboard automatically detects incompatible loader combinations.

Server lagging with Function Compiler – how to optimize performance?

Recommended RAM: 4 GB (per 8 players). Use /spark profiler to check if Function Compiler consumes the most tick time. Common fixes: reduce server view-distance to 8-10, install "performant" or "starlight" as supplementary mods on Forge. With Mado Hosting, your server runs on NVMe SSDs with dedicated CPU cores for minimal latency.

Rent Modded Server

Install Function Compiler with just one click on your server.

Recommended RAM
4 GBab €8/mo
Min. 3 GB | +1 GB pro 8 Spieler
Create Server Now
1-Click Mod Install
NVMe SSD Storage
DDoS Protection included

Details

License
GNU Lesser General Public License v3.0 only
Server-side
Required

Supported Versions

1.21.41.21.31.21.21.21.11.211.20.61.20.51.20.41.20.31.20.2+3 more