
Modrinth · Minecraft mod
Function Compiler
This mod allows the server to automatically compile most of the functions to Java bytecode
Quick answer
Which Function Compiler release matches 1.21.2?
Function Compiler 0.3.2-alpha.2+1.21.2 targets 1.21.2, 1.21.3 with Fabric, Quilt. Do not install it on the client. It must be installed on the dedicated server. No extra mods listed for this file.
Where it goes
Is Function Compiler required on the client, server, or both?
Do not install it on the client. It must be installed on the dedicated server.
This file is marked server-only.
What else does Function Compiler 0.3.2-alpha.2+1.21.2 need?
0.3.2-alpha.2+1.21.2 on 1.21.2. Every mod below is checked against that same setup.
This file does not list any required mods. Do not add a library just because a different file uses it.
This file does not list any required or optional mods.
Before you install it
Add Function Compiler without breaking your instance.
Built for Function Compiler 0.3.2-alpha.2+1.21.2 on 1.21.2. Pick another file and the loader, install side or required mods may change.
- 01
Stick to this file
Use 0.3.2-alpha.2+1.21.2. It targets 1.21.2, 1.21.3 with Fabric, Quilt; another release may have different loader, side or dependency requirements.
- 02
Bring the mods it needs
This file does not list any required mods. Do not add a library just because a different file uses it.
- 03
Put it on the correct side
Do not install it on the client. It must be installed on the dedicated server.
- 04
Pick the file you checked
Use the “Get this file” button beside 0.3.2-alpha.2+1.21.2. It opens that exact file at the source.
About this project
What does Function Compiler add?
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.
Project description from Modrinth.
Pick your setup
Function Compiler by Minecraft version and loader
Choose the version and loader you play, then open the matching release.
1.21.3
2 loader builds1.21.2
2 loader builds1.21.1
2 loader builds1.21
2 loader builds1.20.6
2 loader builds1.20.5
2 loader builds1.20.4
2 loader builds1.20.3
2 loader builds1.20.2
2 loader builds1.20.1
2 loader builds1.20
2 loader buildsShowing the newest 12 of 13 game versions. Older files are in the list below.
Check the dependencies, then try the file in a copied instance before changing a world you care about.
Recent files
Function Compiler versions and loaders
0.3.2-alpha.2+1.21.2
mcfc-0.3.2-alpha.2+1.21.2-fabric.jar
16 Mar 2025
0.3.2-alpha.1+1.21.2
mcfc-0.3.2-alpha.1+1.21.2-fabric.jar
8 Mar 2025
0.3.1-alpha.2+1.21.2
mcfc-0.3.1-alpha.2+1.21.2-fabric.jar
23 Feb 2025
0.3.1-alpha.1+1.21.2
mcfc-0.3.1-alpha.1+1.21.2-fabric.jar
5 Feb 2025
0.3.0-alpha.4+1.21.2
mcfc-0.3.0-alpha.4+1.21.2-fabric.jar
25 Jan 2025
0.3.0-alpha.3+1.21.2
mcfc-0.3.0-alpha.3+1.21.2-fabric.jar
21 Jan 2025
0.3.0-alpha.2+1.21.2
mcfc-0.3.0-alpha.2+1.21.2-fabric.jar
19 Jan 2025
Looking for an older file? The official Modrinth project page is in Resources.