Formula Loader
by OftenOviour
Formula Loader is a library that reads custom math formulas from JSON files and evaluates them in-game with parameters passed through commands.
What it does
Formula Loader loads formulas from datapack JSON files at startup, so modders and datapack creators can define arithmetic expressions without writing Java. Each formula takes named parameters, which are supplied through an in-game command and evaluated on the fly. A FormulaBuilder class lets developers construct formula JSON programmatically instead of writing the files by hand.
Once loaded, each formula is compiled into a stack-based bytecode virtual machine. The library reports per-evaluation timings of about 9 ns for simple arithmetic, 14 ns for three sequential steps, 15 ns for chained conditionals with three branches, and 40 ns for trigonometry with rounding.
It is required on the server and optional for players. It is open source under the GNU Lesser General Public License v2.1 only, and it is published for Fabric, Forge and NeoForge across 19 release versions, 1.18.2 – 26.1.2. TConstruct Armor Extension requires it.
Key features
JSON formula files
Formulas are defined in JSON, so datapack users can add or change them without recompiling a mod.
Operator and function set
Arithmetic operators, min, max, pow, log, div, floor division, rounding functions and the sin, cos, tan and inverse trigonometric functions are available.
Unary minus without parentheses
Expressions such as -3, -x or -min(b, 1) + -x parse without needing extra parentheses.
Programmatic construction
The FormulaBuilder class builds formula JSON in code, which suits generators and tools that create many formulas.
Compiled evaluation
Formulas are compiled to bytecode when loaded, with constant folding and opcode merging to shorten evaluation.
Gallery
Compatibility
Latest build for each game version and loader.
26.x3 of 3 versions with builds
1.21.x11 of 11 versions with builds
1.20.x1 of 1 version with builds
1.19.x3 of 3 versions with builds
1.18.x1 of 1 version with builds
Only full game releases are shown. This mod publishes no snapshot builds.
Required by 1 mod
Use cases
Who it’s for: The library suits datapack creators and mod developers who want formulas that are edited as data. Players who only play with other mods do not need to interact with it directly.
Questions
Does Formula Loader have to be installed on the client?
Which loaders does Formula Loader support?
Which mods require Formula Loader?
In the catalog
Formula Loader is one of 3,514 Library mods on ModsFinder, and one of 2,348 Library mods for Fabric. 15,189 mods support Minecraft 26.1.2.
More from OftenOviour
Similar mods
What the author says
Arithmetic operators: +, -,, /, % (floor remainder: a - floor(a / b) b) Two-argument formulas: min(x, y), max(x, y), pow(x, y), log(x, y) (logarithm base x of y), div(x, y) (floor division toward negative infinity)
Official listing
- Modrinth page
- modrinth.com/mod/formula-loader
- Owner
- OftenOviour
- Published
- 2026-06-08
- Updated on Modrinth
- 2026-06-18
- Facts verified
- 2026-10-15
