Extract built-in Iris features into the default module

Move existing feature implementations and pack models out of core into modules/default without changing packages or algorithms. Compile both source roots together while legacy engine dependencies remain. Add source ownership checks, preserve the Bukkit purity ceiling across both roots, and update source-based diagnostics and archives.

Validation: fresh compilation preserves all 1,995 runtime class hashes; module and Bukkit artifact checks pass. Targeted runs cover 955 tests, with 953 passing and two platform-fixture failures reproduced on the original commit.
This commit is contained in:
piexel committed 2026-10-04 14:17:56 +02:00
1 parent 846bd3e696
commit 5544c96bc5
395 files changed
+178 -15

No files matched your search

+5
View File
@@ -29,6 +29,11 @@ Canonical English is defined in the typed Java catalogs under `core/src/main/jav
Java 25 is required on every platform.
Built-in feature implementations and their pack settings live in
[`modules/default`](modules/default/README.md). During the extraction stage they retain their
engine dependencies and compile together with the host; the existing platform artifacts still
bundle them. Core owns lifecycle, loading, scheduling, storage and platform integration.
The modded feature set matches the plugin wherever the operation is not Bukkit-bound: worldgen
from Iris packs, authoring with mod blocks/items/entities (with validation suggestions), studio
workspaces with schema autocomplete over the server's live registries, entity spawning parity
+2
View File
@@ -324,6 +324,8 @@ List<Object> moddedSharedInputs = []
'adapters/client-common/src',
'core/src/main',
'core/build.gradle',
'modules/default',
'gradle/default-module.gradle',
'spi/src/main',
'spi/build.gradle',
'build.gradle',
+16 -10
View File
@@ -461,26 +461,32 @@ sourceSets {
}
}
apply from: rootProject.file('gradle/default-module.gradle')
tasks.register('bukkitPurityRatchet') {
group = 'verification'
description = 'Fails if files outside core/purity-allowlist.txt import org.bukkit (the allowlist only shrinks).'
description = 'Checks host and default module Bukkit imports against the existing purity ceiling.'
File allowlistFile = project.file('purity-allowlist.txt')
File sourceRoot = project.file('src/main/java')
File defaultModuleSourceRoot = rootProject.file('modules/default/src/main/java')
inputs.file(allowlistFile)
inputs.dir(sourceRoot)
inputs.dir(defaultModuleSourceRoot)
doLast {
Set<String> allowed = allowlistFile.readLines().findAll { String line -> !line.isBlank() }.toSet()
List<String> offenders = new ArrayList<>()
List<String> coupled = new ArrayList<>()
sourceRoot.eachFileRecurse { File f ->
if (!f.name.endsWith('.java')) {
return
}
if (f.text.contains('org.bukkit')) {
String rel = sourceRoot.toPath().relativize(f.toPath()).toString()
coupled.add(rel)
if (!allowed.contains(rel)) {
offenders.add(rel)
[sourceRoot, defaultModuleSourceRoot].each { File root ->
root.eachFileRecurse { File f ->
if (!f.name.endsWith('.java')) {
return
}
if (f.text.contains('org.bukkit')) {
String rel = root.toPath().relativize(f.toPath()).toString()
coupled.add(rel)
if (!allowed.contains(rel)) {
offenders.add(rootProject.projectDir.toPath().relativize(f.toPath()).toString())
}
}
}
}
@@ -30,8 +30,8 @@ public class DiagnosticSeverityPolicyTest {
assertLoggedWith("util/project/hunk/Hunk.java", "OUT OF BOUNDS ", "debug");
assertLoggedWith("engine/mantle/MantleWriter.java", "No set? ", "debug");
assertLoggedWith("engine/mantle/MantleWriter.java", "Mantle Writer Accessed chunk out of bounds", "debug");
assertLoggedWith("engine/object/IrisDecorator.java", "Empty Block Data for ", "warnOnce");
assertLoggedWith("engine/object/IrisCompat.java", "Can't find block data for ", "warnOnce");
assertLoggedWith("engine/object/decoration/IrisDecorator.java", "Empty Block Data for ", "warnOnce");
assertLoggedWith("engine/object/compatibility/IrisCompat.java", "Can't find block data for ", "warnOnce");
assertLoggedWith("engine/data/cache/AtomicCache.java", "Atomic cache supplier failed: %s: %s", "warnOnce");
assertLoggedWith("engine/IrisComplex.java", "Failed to sample interpolated biome bounds", "warnOnce");
assertLoggedWith("engine/framework/placer/WorldObjectPlacer.java", "Tried to place custom block at", "warnOnce");
@@ -59,7 +59,12 @@ public class DiagnosticSeverityPolicyTest {
@Test
public void coreProductionDoesNotWriteDirectlyToProcessStreams() throws IOException {
try (Stream<Path> files = Files.walk(Path.of("src/main/java"))) {
assertNoProcessStreamWrites(Path.of("src/main/java"));
assertNoProcessStreamWrites(defaultModuleSources());
}
private static void assertNoProcessStreamWrites(Path sourceRoot) throws IOException {
try (Stream<Path> files = Files.walk(sourceRoot)) {
List<Path> bypasses = files
.filter(path -> path.toString().endsWith(".java"))
.filter(path -> {
@@ -118,7 +123,7 @@ public class DiagnosticSeverityPolicyTest {
*/
@Test
public void theUnusedDebugImageWriterIsGone() throws IOException {
assertFalse(read("engine/object/IrisImage.java").contains("writeDebug"));
assertFalse(read("engine/object/image/IrisImage.java").contains("writeDebug"));
}
/**
@@ -180,6 +185,14 @@ public class DiagnosticSeverityPolicyTest {
}
private static String read(String relativePath) throws IOException {
return Files.readString(Path.of("src/main/java/art/arcane/iris").resolve(relativePath)).replace("\r\n", "\n");
Path source = Path.of("src/main/java/art/arcane/iris").resolve(relativePath);
if (!Files.isRegularFile(source)) {
source = defaultModuleSources().resolve("art/arcane/iris").resolve(relativePath);
}
return Files.readString(source).replace("\r\n", "\n");
}
private static Path defaultModuleSources() {
return Path.of(System.getProperty("iris.defaultModuleSources", "../modules/default/src/main/java"));
}
}
+56
View File
@@ -0,0 +1,56 @@
import org.gradle.api.tasks.bundling.Jar
// The first extraction keeps the legacy host/feature dependency cycle intact. Compile both
// source roots together until the built-ins have been ported to the public IrisApi contracts.
File defaultModuleDirectory = rootProject.file('modules/default')
File defaultModuleSources = new File(defaultModuleDirectory, 'src/main/java')
File sourcePatternsFile = new File(defaultModuleDirectory, 'source-patterns.txt')
List<String> featureSourcePatterns = sourcePatternsFile.readLines().findAll { !it.isBlank() }
sourceSets.main.java.srcDir(defaultModuleSources)
def verifyDefaultModuleOwnership = tasks.register('verifyDefaultModuleOwnership') {
group = 'verification'
description = 'Checks that extracted built-ins have one source owner outside core.'
inputs.file(sourcePatternsFile)
inputs.dir(defaultModuleSources)
inputs.dir(project.file('src/main/java'))
doLast {
Set<File> coreFeatureSources = fileTree(project.file('src/main/java')) {
include(featureSourcePatterns)
}.files
if (!coreFeatureSources.isEmpty()) {
throw new GradleException("Built-in sources must live in modules/default: ${coreFeatureSources}")
}
Set<File> unexpectedSources = fileTree(defaultModuleSources) {
include('**/*.java')
exclude(featureSourcePatterns)
}.files
if (!unexpectedSources.isEmpty()) {
throw new GradleException("Default module sources need declared ownership: ${unexpectedSources}")
}
featureSourcePatterns.each { String pattern ->
if (fileTree(defaultModuleSources) { include(pattern) }.isEmpty()) {
throw new GradleException("Missing default module source family: ${pattern}")
}
}
}
}
tasks.named('compileJava').configure {
dependsOn(verifyDefaultModuleOwnership)
}
tasks.named('test').configure {
systemProperty('iris.defaultModuleSources', defaultModuleSources.absolutePath)
}
tasks.register('defaultModuleSourcesJar', Jar) {
group = 'build'
description = 'Packages the extracted built-in sources without the host implementation.'
archiveBaseName.set('iris-default-module')
archiveClassifier.set('sources')
from(defaultModuleSources)
}
+63
View File
@@ -0,0 +1,63 @@
# Default Iris module
This module owns the existing built-in feature sources extracted from `core`. This is the
behavior-preserving extraction stage: packages, pack fields, seeds, algorithms and engine
dependencies are retained. These implementations have not yet been ported to IrisApi.
## Feature inventory
All paths below are relative to `src/main/java/art/arcane/iris/engine`.
| Family | Sources |
| --- | --- |
| Terrain, biome and decoration actuators | `actuator/` |
| Surface, ceiling, shoreline, sea-floor, sea-surface and floating decoration | `decorator/` |
| Cave application, deposits, post-processing, floating terrain, perfection and custom blocks | `modifier/` |
| Overworld, islands, enclosure and superflat composition | `mode/` |
| Cave generation, object distribution, floating objects and structure foundations/carving | `mantle/components/` |
| Trees, crystals, fungi, coral, formations and ruins | `object/procedural/` |
| Height modes, stilts, ceiling hanging, vacuum, paint, floating, slope, support, collision, boring and snow | `object/placement/` |
| Terrain generators, ores, deposit variants, cave profiles and floating child biomes | `object/terrain/` |
| Structure distribution, jigsaw settings, graph compilation and assembly | `object/structure/`, `framework/structure/`, selected `framework/*.java` |
| Prefabs, transforms, tile data and matter objects | `object/prefab/` |
| Block palettes, decorator settings and noise/expressions | `object/material/`, `object/decoration/`, `object/noise/` |
| Images, maps, bindings, masks and compiled sampling | `object/image/`, `image/` |
| Entities, ambient effects, spawning, loot, markers and pack transformations | `object/entity/`, `object/loot/`, `object/marker/`, `object/mod/` |
| Dimension, region and biome configuration, annotations and shared settings values | `object/world/`, `object/annotations/`, `object/value/`, `object/compatibility/` |
Core retains engine lifecycle, pack loading, compiled invocation data, storage, scheduling,
platform interfaces/adapters, native Minecraft generation coordination, and runtime integrations.
For example, entity/loot/tree definitions live here; the platform services that apply them remain
with the host. Moving those services to the public runtime interfaces is later work.
## Build ownership during extraction
Core and these sources refer to each other. `gradle/default-module.gradle` adds this source root
to the host compilation so existing callers and every platform distribution keep the same class
names and bundled bytecode. There is one source copy and one compilation; no dependency cycle is
introduced between Gradle projects. The binary still ships with the host.
`source-patterns.txt` defines source ownership. `:core:verifyDefaultModuleOwnership` rejects
feature sources moved back into core, undeclared additions, and missing feature families. It runs
before compilation. The existing Bukkit purity ceiling covers both roots; extraction does not
reset or raise it. Source-based integration checks also inspect both roots.
The sibling workspace project exposes this tree through `IrisModule/src/builtin/java`. That
directory is a relative symbolic link, so editing it edits these tracked sources. Keeping the
canonical files in the Iris repository makes the extraction a complete, reviewable commit and
keeps a fresh Iris checkout buildable. API examples remain in `IrisModule/src/main/java/com/volmit/example`.
From the Iris repository:
```sh
./gradlew :core:compileJava :core:bukkitPurityRatchet :core:defaultModuleSourcesJar
./gradlew :core:test
```
Feature tests stay in `core/src/test/java` because they exercise the legacy host integration.
The source archive contains only this module. The existing host source archive contains both
roots, matching the combined binary.
The next stage replaces engine dependencies family by family with public registration,
generation, geometry, placement, resource, storage and runtime interfaces. Independent addon
compilation and a separate feature binary belong to that stage.
+18
View File
@@ -0,0 +1,18 @@
art/arcane/iris/engine/actuator/**
art/arcane/iris/engine/decorator/**
art/arcane/iris/engine/modifier/**
art/arcane/iris/engine/mode/**
art/arcane/iris/engine/mantle/components/**
art/arcane/iris/engine/object/**
art/arcane/iris/engine/image/**
art/arcane/iris/engine/framework/structure/**
art/arcane/iris/engine/framework/StructureAssembler.java
art/arcane/iris/engine/framework/IrisStructureLocator.java
art/arcane/iris/engine/framework/StructureCaveAnchorResolver.java
art/arcane/iris/engine/framework/StructureReachability.java
art/arcane/iris/engine/framework/StructurePlacementScope.java
art/arcane/iris/engine/framework/StructurePlacementGrid.java
art/arcane/iris/engine/framework/StructurePlacementMarker.java
art/arcane/iris/engine/framework/StructureVerticalBounds.java
art/arcane/iris/engine/framework/PlacedObject.java
art/arcane/iris/engine/framework/PlacedStructurePiece.java
Loaded 100 of 395 files, more files were not shown because too many files have changed in this diff. Show more