neoforge-1.21.1: runtime fixes and build improvements

- Fix ServerTickEvent: register listener for ServerTickEvent.Post instead of
  abstract ServerTickEvent base class (NeoForge 21.x requirement)
- Fix null BlockGetter: replace null with EmptyBlockGetter.INSTANCE in
  isSolidRender() and propagatesSkylightDown() calls (1.21+ actually uses param)
- Fix chunk iteration: replace direct visibleChunkMap field access with
  getChunks() iteration and getChunkToSend() with getLatestChunk() (1.21.1 API)
- Build: fix shadowJar config to properly bundle DynmapCore into fat jar
  (was producing 80KB hollow jar missing all core classes)
- Build: cap Gradle daemon and forked javac heap to prevent OOM on large hosts
- Tested: server starts cleanly, Dynmap web UI accessible, maps rendered
This commit is contained in:
Sulkta 2026-03-07 09:41:38 -08:00
parent 4fd6b31aa6
commit bd07616505
3 changed files with 26 additions and 11 deletions

View file

@ -30,10 +30,15 @@ minecraft {
}
}
configurations {
shadow
implementation.extendsFrom shadow
}
dependencies {
implementation 'net.neoforged:neoforge:21.1.219'
// DynmapCore and DynmapCoreAPI as local jars (build these separately)
implementation fileTree(dir: 'libs', include: ['*.jar'])
// DynmapCore bundled into the fat jar via shadow config
shadow fileTree(dir: 'libs', include: ['*.jar'])
}
processResources {
@ -50,7 +55,13 @@ shadowJar {
mergeServiceFiles()
archiveBaseName = 'Dynmap'
archiveVersion = project.version
archiveClassifier = 'neoforge-1.21.1'
// Exclude signature files that cause security exceptions
exclude 'META-INF/*.RSA'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
}
tasks.jar {
@ -66,4 +77,11 @@ tasks.jar {
}
}
build.dependsOn(jar)
// Build the fat jar, not the thin one
build.dependsOn(shadowJar)
// Cap memory on forked javac process (prevents OOM on large NeoForge compile)
tasks.withType(JavaCompile).configureEach {
options.fork = true
options.forkOptions.memoryMaximumSize = '3g'
}