Back to mods
Function Compiler project artwork

Modrinth · Minecraft mod

Function Compiler

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

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which Function Compiler release matches 1.21.2?

Updated 1 year ago
alpha file 0.3.2-alpha.2+1.21.2
Game version 1.21.2, 1.21.3
Loader Fabric, Quilt

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.

Client Not supported
Dedicated server Required
Loader for this release Fabric, Quilt
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

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.

No extra mods listed for this file

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.

  1. 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.

  2. 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.

  3. 03

    Put it on the correct side

    Do not install it on the client. It must be installed on the dedicated server.

  4. 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.

26 available setups

Showing 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

7 of 100 releases match
Clear filters

Looking for an older file? The official Modrinth project page is in Resources.