Skip to content

feat(neoforge): Add NeoForge 1.21.1 support#4255

Open
Cobbert wants to merge 3 commits intowebbukkit:neoforgefrom
Cobbert:neoforge-1.21.1-pr
Open

feat(neoforge): Add NeoForge 1.21.1 support#4255
Cobbert wants to merge 3 commits intowebbukkit:neoforgefrom
Cobbert:neoforge-1.21.1-pr

Conversation

@Cobbert
Copy link

@Cobbert Cobbert commented Mar 8, 2026

feat(neoforge): Add NeoForge 1.21.1 support

What this adds

Adds a new neoforge-1.21.1 module for NeoForge support on Minecraft 1.21.1. This is a direct port of the neoforge-1.20.6 module with only the API changes required by NeoForge 21.1.x and Minecraft 1.21.1.

Changes from neoforge-1.20.6

Package/Import Changes

  • Package rename: neoforge_1_20_6neoforge_1_21_1
  • Imports: net.minecraftforge.*net.neoforged.*
  • EventBus: net.minecraftforge.eventbus.api.*net.neoforged.neoforge.eventbus.api.*

API Changes (Required by NeoForge 21.x / MC 1.21.1)

Location Old API New API Reason
DynmapPlugin.java L254 isSolidRender(EmptyBlockGetter.INSTANCE, BlockPos.ZERO) canOcclude() API signature changed in 1.21.1; also fixes Guava LoadingCache deadlock with modernfix/ferritecore
DynmapPlugin.java L254 propagatesSkylightDown(...) isAir() Same as above
DynmapPlugin.java L263 isSolid() canOcclude() Method behavior changed
DynmapPlugin.java L706,1555,1689,1849 MinecraftForge.EVENT_BUS NeoForge.EVENT_BUS NeoForge package restructure
DynmapPlugin.java L925-927 Phase.START check Removed NeoForge 21.x: ServerTickEvent is abstract, uses Pre/Post subclasses
DynmapPlugin.java L1737,1808,1865 getStatus() getPersistedStatus() API rename in 1.21.1
DynmapPlugin.java L1862 getLastAvailable() getLatestChunk() API removed in 1.21.1
NBT.java L21 getAllKeys() keySet() API rename
NBT.java L30-40 contains(s, i) Manual type checking contains(String, int) behavior changed
NBT.java (all getters) getByte(s) etc. getByteOr(s, default) etc. Null-safe API changes
NBT.java L72,76 getCompound(s)/getList(s,i) getCompoundOrEmpty(s)/getListOrEmpty(s) API rename
NBT.java L96-98 obj.get(s).getAsString() Null check + asString().orElse("") NPE safety

Build Configuration Changes

  • build.gradle:

    • net.neoforged.gradle.userdev version: 7.0.1337.1.20
    • net.neoforged:neoforge: 20.6.62-beta21.1.219
    • Project name/classifier updated for 1.21.1
  • neoforge.mods.toml:

    • loaderVersion: [2,)[4,)
    • NeoForge versionRange: [20.6,)[21.1,)
    • Minecraft versionRange: [1.20.6,1.21)[1.21.1,1.22)

Java 21 Requirement

NeoForge 1.21.1 requires Java 21 — this is a platform requirement, not a code choice. The module is configured for Java 21 toolchain.

Gradle/Build System Changes

Gradle Wrapper: Updated from 8.7 to 8.14.

This is required because NeoForge Gradle userdev 7.1.20 (needed for NeoForge 21.1.x) requires Gradle 8.8+. The dependency chain:

NeoForge 21.1.x → userdev 7.1.20 → Gradle 8.8+

fabric-loom: Updated from 1.6.11 to 1.8.13 in all 10 fabric modules.

fabric-loom 1.6.11 is not compatible with Gradle 8.14. This is a transitive requirement — without updating loom, the existing fabric modules would fail to build after the Gradle upgrade. Verified that fabric-1.20.6 still builds successfully with loom 1.8.13.

Note: --configure-on-demand flag is recommended when building to avoid plugin conflicts between multiple NeoForge subproject versions.

Test Results

Tested on ATM10 5.5 modpack (445 mods):

  • Clean server boot
  • Dynmap web interface loads
  • Map renders correctly
  • No errors or warnings related to Dynmap

Code Style Note

This port aims to be strictly minimal. The one structural change beyond API requirements is the event registration pattern — NeoForge 21.x uses addListener() instead of registering annotated inner classes, which required restructuring ChatHandler from an inner class to a direct method. All other changes are API-forced.

AI Assistance Disclosure

This port was developed with AI assistance (Claude, acting as an agent on behalf of the contributor) to deploy a working version for an ATM10 NeoForge server. All changes were reviewed, tested, and verified by the contributor before submission.


Branch: neoforge-1.21.1-pr
Base: neoforge
Fork: https://github.com/Cobbert/dynmap

Cobbert added 3 commits March 7, 2026 12:40
Adds support for NeoForge 1.21.1 (Minecraft 1.21.1).

Changes from neoforge-1.20.6:
- Package rename: neoforge_1_20_6 → neoforge_1_21_1
- Imports: net.minecraftforge.* → net.neoforged.*
- API: MinecraftForge.EVENT_BUS → NeoForge.EVENT_BUS
- API: isSolidRender()/propagatesSkylightDown() → canOcclude()/isAir()
- API: isSolid() → canOcclude()
- API: getStatus() → getPersistedStatus()
- API: getLastAvailable() → getLatestChunk()
- API: ServerTickEvent phase check removed (NeoForge 21.x uses subclasses)
- NBT API: Updated for 1.21.1 method changes

Build config:
- neoforge.mods.toml: loaderVersion [4,), versionRange [21.1,)
- build.gradle: neoforge 21.1.219, userdev 7.1.20

Note: This module requires Gradle 8.8+ due to NeoForge Gradle userdev
requirements. The monorepo may need a Gradle wrapper upgrade.

Tested on ATM10 5.5 with 445 mods (standalone build).
- Upgrade Gradle wrapper: 8.7 -> 8.14
- Upgrade fabric-loom: 1.6.11 -> 1.8.13 (all 10 fabric modules)
- Add neoforge-1.21.1 module with working source code:
  - DynmapMod.java, DynmapPlugin.java, ForgeMapChunkCache.java, NBT.java
  - accesstransformer.cfg: exposes serverLevelData, visibleChunkMap fields
  - neoforge.mods.toml: mod metadata
- Fix neoforge-1.21.1/build.gradle: add minecraft { accessTransformers {} } block
- Build requires --configure-on-demand to avoid IdeaExtPlugin conflict
  between multiple NeoForge subproject versions

Verified builds:
  :neoforge-1.21.1:shadowJar -> target/Dynmap-3.7-SNAPSHOT-neoforge-1.21.1.jar
  :fabric-1.20.6:build -> SUCCESS
@Cobbert
Copy link
Author

Cobbert commented Mar 8, 2026

This is running on my atm10 server, no issues yet, please advised if there are issues, I can go back and verify anything needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant