Home›Java›Mods›expr4j
ModsJava

expr4j

Java mod listed for Minecraft 1.7–1.18. Download on the author's site.

⬇ Download on Spigot
expr4j

This project is a heavily tuned fork of the original expr4j/expr4j expression engine. The upstream repository went offline, so this fork keeps the project accessible while adding better packaging, docs, and ready-to-use shaded artifacts. It keeps the generic, token-based parser but streamlines module publishing for plugin ecosystems and JVM apps alike.

Modules & Packaging

All published artifacts live under the me.croabeast.expr4j group. The repository provides both regular and shaded JARs:


Big-decimal and complex implementations require their external libraries when using the non-shaded artifacts; you can declare them as dependencies or add them as libraries in your plugin.yml. The shaded artifacts already include everything, so you can reference them directly.

Non-shaded Dependency Examples

Add the repository and declare the dependencies you need. Non-shaded big-decimal and complex require their math libraries:

Code (Kotlin):
repositories {
    maven ( "https://croabeast.github.io/repo" )
}

dependencies {
    implementation ( "me.croabeast.expr4j:core:<version>" )
    implementation ( "me.croabeast.expr4j:double:<version>" )
    implementation ( "me.croabeast.expr4j:big-decimal:<version>" )
    implementation ( "me.croabeast.expr4j:complex:<version>" )

    // External requirements for non-shaded modules
    implementation ( "ch.obermuhlner:big-math:2.3.2" )
    implementation ( "org.apache.commons:commons-numbers-complex:1.2" )
}
If you only need one implementation, keep core plus your chosen module. Shaded variants ( <module>-shaded) already bundle core and the external math libraries.

Repository

Artifacts are published to https://croabeast.github.io/repo/ with the path me/croabeast/expr4j. Add the repository and pick the modules you need.

Gradle (Kotlin DSL)

Code (Kotlin):
repositories {
    maven ( "https://croabeast.github.io/repo" )
}

dependencies {
    implementation ( "me.croabeast.expr4j:core:<version>" )
    implementation ( "me.croabeast.expr4j:double:<version>" )
    // Optional extras:
    // implementation("me.croabeast.expr4j:big-decimal:<version>")
    // implementation("me.croabeast.expr4j:complex:<version>")
}
Maven

Code (XML):
<repositories>
  <repository>
    <id>croabeast-repo </id>
    <url>https://croabeast.github.io/repo </url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>me.croabeast.expr4j </groupId>
    <artifactId>core </artifactId>
    <version> <!-- your version --> </version>
  </dependency>
  <dependency>
    <groupId>me.croabeast.expr4j </groupId>
    <artifactId>double </artifactId>
    <version> <!-- your version --> </version>
  </dependency>
</dependencies>
If you prefer shaded binaries, replace double or big-decimal / complex with <module>-shaded and omit the extra dependencies.

Quick Start

Create a builder for your numeric type, register variables, and evaluate:

Code (Java):
DoubleBuilder builder = new DoubleBuilder ( ) ;
Expression <Double > expression = builder. build ( "2 * cos(x) + y/4" ) ;

Map < String, Double > variables = new HashMap <> ( ) ;
variables. put ( "x", Math. PI / 2 ) ;
variables. put ( "y", 8.0 ) ;

Double result = expression. evaluate (variables ) ; // -> 3.0
Complex and BigDecimal builders expose the same API, so swapping types is effortless when you need more precision or imaginary components.

Implementation Notes


If you want to load non-shaded modules instead, add both core and the implementation, plus the external libraries in the same libraries block.

Why This Fork?

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

expr4j is a free Minecraft Java mod. Compatible with Minecraft 1.7, 1.8, 1.9, 1.10 and newer. Downloaded 22 times (via Spigot). Download it and open it directly in the game.

Explore more