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:
Kayos 2026-03-07 09:41:38 -08:00
parent 040b3e6f55
commit 2a8115ec8b
3 changed files with 26 additions and 11 deletions

View file

@ -245,7 +245,7 @@ public class DynmapPlugin
}
int lightAtten = 15;
try { // Workaround for mods with broken block state logic...
lightAtten = bs.isSolidRender(null, BlockPos.ZERO) ? 15 : (bs.propagatesSkylightDown(null, BlockPos.ZERO) ? 0 : 1);
lightAtten = bs.isSolidRender(net.minecraft.world.level.EmptyBlockGetter.INSTANCE, BlockPos.ZERO) ? 15 : (bs.propagatesSkylightDown(net.minecraft.world.level.EmptyBlockGetter.INSTANCE, BlockPos.ZERO) ? 0 : 1);
} catch (Exception x) {
Log.warning(String.format("Exception while checking lighting data for block state: %s[%s]", bn, statename));
Log.verboseinfo("Exception: " + x.toString());
@ -913,7 +913,7 @@ public class DynmapPlugin
}
@SubscribeEvent
public void tickEvent(ServerTickEvent event) {
public void tickEvent(ServerTickEvent.Post event) {
cur_tick_starttime = System.nanoTime();
long elapsed = cur_tick_starttime - lasttick;
lasttick = cur_tick_starttime;
@ -1850,13 +1850,10 @@ public class DynmapPlugin
for (ServerLevel world : server.getAllLevels()) {
ForgeWorld fw = getWorld(world);
if (fw == null) continue;
Long2ObjectLinkedOpenHashMap<ChunkHolder> chunks = world.getChunkSource().chunkMap.visibleChunkMap;
for (Entry<Long, ChunkHolder> k : chunks.long2ObjectEntrySet()) {
long key = k.getKey().longValue();
ChunkHolder ch = k.getValue();
for (ChunkHolder ch : world.getChunkSource().chunkMap.visibleChunkMap.values()) {
ChunkAccess c = null;
try {
c = ch.getChunkToSend();
c = ch.getLatestChunk();
} catch (Exception x) { }
if (c == null) continue;
ChunkStatus cs = c.getPersistedStatus();