Building from source
Requirements
Section titled “Requirements”- JDK 25 to run Gradle. The JDKs for the older targets (17 for 1.20.1, 21 for 1.21.1) are found on your machine or downloaded automatically.
- Nothing else: the Gradle wrapper is in the repository, and Gradle downloads the rest, NightLib included.
Commands
Section titled “Commands”./gradlew build # every Minecraft version × loader, plus the engine tests./gradlew :core:test # engine unit tests only (a few seconds, no game needed)./gradlew :fabric:1.21.1:build # a single targetThe jars end up in <loader>/versions/<minecraft>/build/libs/, for example
fabric/versions/1.21.1/build/libs/ipreforged-fabric-0.1.0-alpha.1+1.21.1.jar.
Repository layout
Section titled “Repository layout”Directorycore/ the engine: plain Java, no Minecraft classes, with JUnit tests
- …
Directorysrc/ the game layer, shared by every version and loader
- …
Directoryversions/
Directory1.20.1/ version-specific properties of the shared code
- …
Directory1.21.1/
- …
Directory26.1.2/
- …
Directory26.3/
- …
Directoryfabric/ Fabric entry points and services, one project per version
- …
Directoryforge/ Forge entry points (1.20.1)
- …
Directoryneoforge/ NeoForge entry points
- …
How versions and loaders are handled
Section titled “How versions and loaders are handled”- Stonecutter builds the shared code once per
Minecraft version. The code in
src/is written for the active version; lines that differ between versions sit in Stonecutter comments such as//? if >=26.1 {. Switch the active version with the Stonecutter Gradle tasks (“Set active project to …”), never by editing those comments by hand. - Architectury Loom is only the build toolchain: neither the mod nor NightLib uses the Architectury API, so players don’t need it.
- Mappings. Minecraft 1.20.1 and 1.21.1 use Mojang’s mappings with Parchment parameter names. Minecraft 26.x ships without obfuscation, so its targets build without any remapping.
Rules of the codebase
Section titled “Rules of the codebase”- No
@Overwriteand no@Redirect. Mixins must compose with other mods: use injections and MixinExtras wrappers. The CI build checks this. - The engine stays pure.
core/must not reference Minecraft or loader classes, so it can be tested without the game and shared by every target. - Original names only. Immersive Portals by qouteall is a reference for behaviour. Do not copy its code, class names or method names.
- Augment vanilla, do not replace it. Vanilla chunk and entity tracking keep working for the player’s own dimension, and vanilla packets carry no extra bytes.
Before you send a change
Section titled “Before you send a change”- Run
./gradlew :core:testif you touched the engine. - Build the targets your change affects, or all of them with
./gradlew build. - Run the in-game tests for anything players can see or feel: rendering, crossing, lit frames.
