Skip to content

Building from Source

denfry edited this page Oct 13, 2026 · 1 revision

Building from Source

Note

Current state: milestone M0 (scaffold). The project builds, loads into Minecraft and passes its bootstrap tests, but it has no gameplay yet: no blocks or items are registered. The jar is useful only for development. See Roadmap.

Prompt Critical is a Minecraft 1.21.1 mod for NeoForge, built with Gradle and ModDevGradle. This page covers building the jar, running a development client or server, the test tasks, and the CI pipeline.

Requirements

Tool Version Notes
JDK 21 All subprojects use a Java 21 toolchain. The foojay resolver plugin (org.gradle.toolchains.foojay-resolver-convention 1.0.0) can download one automatically if none is installed.
Gradle 9.4.1 Via the included wrapper (gradlew / gradlew.bat); no separate install needed
Git any
Internet access — First build downloads Minecraft, NeoForge, Create and CC: Tweaked artifacts

Gradle settings from gradle.properties: -Xmx2G for the daemon, build cache on, parallel execution and configuration cache off.

Quick start

git clone https://github.com/denfry/Prompt_Critical.git
cd Prompt_Critical
./gradlew build

On Windows use gradlew.bat build (or .\gradlew build in PowerShell).

The mod jar lands in:

pc-mod/build/libs/promptcritical-<version>+1.21.1.jar

With the current mod_version=0.0.1 this is promptcritical-0.0.1+1.21.1.jar. The version string is <mod_version>+<minecraft> and is set for every subproject in the root build.gradle.kts. The jar contains the classes of pc-sim and pc-api directly (not jar-in-jar), so it is a single self-contained mod file.

Module layout

Prompt_Critical/
├─ settings.gradle.kts         # rootProject "prompt-critical"; include pc-sim, pc-api, pc-mod
├─ build.gradle.kts            # shared: group, version, Java 21 toolchain, UTF-8
├─ gradle.properties           # mod_id, mod_version, mod_group_id, ...
├─ gradle/libs.versions.toml   # all dependency and plugin versions
├─ pc-sim/                     # pure-Java simulation (no Minecraft), JUnit 5 / jqwik / ArchUnit, JMH plugin
├─ pc-api/                     # addon API, depends on pc-sim
├─ pc-mod/                     # NeoForge mod (ModDevGradle)
│  ├─ src/main/java            # dev.denfry.promptcritical.mod
│  ├─ src/main/resources       # assets/promptcritical (models, textures), data, META-INF/neoforge.mods.toml
│  ├─ src/generated/resources  # datagen output (added to main resources)
│  └─ src/gametest/java        # NeoForge GameTests
└─ art/                        # Blockbench sources, previews, generator scripts (see Art-Pipeline)

See Architecture for why the simulation is a separate module.

Mod properties

From gradle.properties:

Property Value
mod_id promptcritical
mod_name Prompt Critical
mod_version 0.0.1
mod_group_id dev.denfry.promptcritical
mod_authors denfry
mod_license All Rights Reserved

These are expanded into META-INF/neoforge.mods.toml during processResources, together with the NeoForge, Minecraft, Create and CC: Tweaked versions.

Dependency versions

All versions live in gradle/libs.versions.toml:

Dependency Version How it is used
Minecraft 1.21.1 —
NeoForge 21.1.259 Required, [21.1.259,)
ModDevGradle (net.neoforged.moddev) 2.0.148 Build plugin
Parchment mappings 2024.11.17 Parameter names
Create 6.0.11 (6.0.11-319) Required at runtime, implementation (non-transitive)
Ponder 1.0.87+mc1.21.1 implementation (bundled in Create's jar in production)
Flywheel 1.0.6 API compileOnly, implementation runtimeOnly
Registrate MC1.21-1.3.0+67 implementation
CC: Tweaked 1.120.2 Optional: common/core/forge APIs compileOnly; full mod runtimeOnly for dev runs
JUnit 5.11.4 pc-sim tests
jqwik 1.9.2 Property-based tests
ArchUnit 1.4.1 Architecture rules
AssertJ 3.27.3 Assertions
JMH Gradle plugin (me.champeau.jmh) 0.7.3 Benchmarks in pc-sim

Maven repositories used by pc-mod: maven.createmod.net (Create, Ponder, Flywheel), maven.ithundxr.dev/snapshots (Registrate), maven.squiddev.cc (CC: Tweaked, restricted to group cc.tweaked), plus Maven Central and the NeoForged Maven for plugins.

To play with a built jar you need, in the mods folder: NeoForge 21.1.259 or newer for Minecraft 1.21.1, Create 6.0.11 or newer, and optionally CC: Tweaked 1.120.2 or newer.

Gradle tasks

The run configurations in pc-mod/build.gradle.kts are named client, server, gameTestServer and data. ModDevGradle turns them into run<Name> tasks:

Task What it does
./gradlew build Compiles all modules, runs pc-sim unit, property and architecture tests, builds the jar
./gradlew :pc-sim:test Simulation tests only (JUnit Jupiter, jqwik and ArchUnit engines)
./gradlew :pc-mod:runClient Development client. Uses the gametest source set, with GameTests for the promptcritical namespace enabled
./gradlew :pc-mod:runServer Development dedicated server with --nogui
./gradlew :pc-mod:runGameTestServer Headless GameTest server; runs the GameTests and exits (non-zero on failure)
./gradlew :pc-mod:runData Data generation: --mod promptcritical --all, output to pc-mod/src/generated/resources, with pc-mod/src/main/resources as existing resources
./gradlew :pc-sim:jmh JMH benchmarks (plugin applied; no benchmarks yet)

All runs log at INFO with the REGISTRIES marker enabled. Dev runs use the working directory pc-mod/run/ (ignored by git), which holds configs such as config/promptcritical-server.toml, logs and the test world.

In dev runs the mod is assembled from four source sets: pc-mod main, pc-mod gametest, pc-sim main and pc-api main. Changes in any of them are picked up without publishing anything.

What the current build contains

  • PromptCritical (@Mod("promptcritical")): registers the server config and installs the addon API.
  • ServerConfig: promptcritical-server.toml with time.k_slow, storage.k_storage, nuclide.k_burn, nuclide.decay_heat_clock, energy.w_per_su, energy.j_per_fe, cc.token_rate, cc.token_burst, server.mode, damage.max_blocks_per_tick.
  • SimClock / TimeDomain in pc-sim.
  • PromptCriticalApi / ApiHolder in pc-api.
  • About 270 placeholder block models, 95 item models and their textures under assets/promptcritical. They are not yet wired to registered blocks.
  • GameTests (BootstrapGameTests, empty 3×3×3 template data/promptcritical/structure/gametest/empty_3x3x3.nbt):
    • apiIsInstalled: API version matches CURRENT_API_VERSION.
    • serverConfigIsLoadedWithDefaults: config loaded, time.k_slow > 0, energy.w_per_su > 0.
    • createIsLoaded: Create is present.

Continuous integration

.github/workflows/build.yml runs on every push to main and on every pull request (ubuntu-latest):

  1. actions/checkout@v4
  2. actions/setup-java@v4: Temurin 21
  3. gradle/actions/setup-gradle@v4
  4. Build and unit tests: ./gradlew build --console=plain
  5. GameTest: ./gradlew :pc-mod:runGameTestServer --console=plain
  6. Upload artifact reports: **/build/reports/ and **/build/test-results/ (always, even on failure)
  7. Upload artifact promptcritical-jar: pc-mod/build/libs/*.jar

Every green CI run therefore produces a downloadable development jar in the run's artifacts. Dependabot (.github/dependabot.yml) checks GitHub Actions versions monthly.

The pull request template asks contributors to confirm:

  • ./gradlew build passes;
  • ./gradlew :pc-mod:runGameTestServer passes (for changes in pc-mod);
  • the wiki is updated if behaviour or names changed.

Troubleshooting

Problem What to check
"No compatible toolchain" Install JDK 21 or let the foojay resolver download it (needs internet access)
Dependency resolution fails for Create / CC: Tweaked The project's Maven repositories (createmod, ithundxr, squiddev) must be reachable
runGameTestServer fails Reports are in pc-mod/build/reports/ and the log in pc-mod/run/logs/latest.log
Datagen output missing runData writes to pc-mod/src/generated/resources, which is added to the main resources
Out of memory during build Increase org.gradle.jvmargs in gradle.properties (default -Xmx2G)

See also

Clone this wiki locally