NeoForge 1.21.1 port (corelib bundled) — draft for discussion - #77
NeoForge 1.21.1 port (corelib bundled) — draft for discussion#77denjiaki wants to merge 3 commits into
Conversation
Ports the mod from Forge/MC 1.20.1 to NeoForge/MC 1.21.1: - Build migrated from the Groovy Forge build to Kotlin ModDevGradle (build.gradle.kts / settings.gradle.kts), targeting NeoForge 21.1. - corelib bundled inside the jar via NeoForge Jar-in-Jar, so no separate corelib download is needed; it remains a REQUIRED dependency. - Source migrated to the 1.21.1 mappings/APIs (rendering, networking, registries, events). - Fix RecruitsCategoryButton: in 1.21.1 the widget draw entry point is renderWidget(), so it now calls super.renderWidget(...) instead of super.render(...), which caused StackOverflow when the group screen opened. Preserves the original project's content: no features added, upstream README/CREDITS/changelog/art retained. The corpse-mod compat is dropped only because that dependency has no 1.21.1 build.
|
I have been working on my own port for a bit(and it is bad), so I have a question. Is this one server stable? I have been trying to get my one to be server stable, but if this current draft is server stable then, I'll use this port. |
From my testing @dark-neon1101 , it boots cleanly on a dedicated server and packet handling looks correct on the thread. But I haven't load tested actual multiplayer gameplay yet. I can say with some certainty that it will work as expected, but it's not battle tested. |
|
Found one bug that I fixed in my one. it tries to save the faction banner when it doesn't exist and crashes. That is fixed by adding a null check. |
|
and also the ticking screen issue with a missing super.tick() in one of the scripts |
|
@dark-neon1101 Thanks for the heads up, will be implementing that later today |
|
strange, all of the proper code seems to be in place. |
|
My mistake, the Super.tick() is present but the null issue still exists |
|
Specifically the problem is in the checkcreationcondition() function as it can try to access the banner when it is empty so if we check for null anyway, we can do an if block for null and empty and return false immediately when it is null or empty and otherwise, the function does everything as before. |
FactionEditScreen#checkCreationCondition and #checkEditCondition called ItemStack.save() while only guarding the banner against null. In 1.21.1 ItemStack.save() throws IllegalStateException on an empty (non-null) stack, so opening the faction screen with an empty banner slot crashed. (The 1.20.1 original used serializeNBT(), which was empty-safe.) Guard both paths against empty banners before the save() call. Behaviour is unchanged for valid banners: an empty banner already made both conditions false. Reported by @dark-neon1101.
FactionEvents.createTeam guarded the banner against null but not empty. MessageCreateTeam decodes the banner via OPTIONAL_STREAM_CODEC, so a modified client can submit ItemStack.EMPTY; the subsequent ItemStack.save() then throws IllegalStateException on the server thread (server crash). Same 1.21.1 save()-throws-on-empty regression as the client-side faction screen fix. Treat empty like null and fall back to the default banner.
|
@dark-neon1101 I took care of the crashes you mentioned. |
|
The faction screen is broken, when I use ANY banner to make a faction it says that I can't use a blank banner to make a faction. My guess is that the GUI closes before the faction creation fully goes through so it fails, I am not sure where exactly the error is though. |
|
@dark-neon1101 Just saw your comment. I deleted a comment from another one of my accounts. I'll get on it by Wednesday this week. I'm swamped with my Job. i've handed the file and PR link to other folks in the meantime so they report any bugs they encounter |
NeoForge 1.21.1 port (for discussion)
This is a draft porting the mod from Forge / MC 1.20.1 to NeoForge / MC 1.21.1. Opening it as a draft because it targets a different Minecraft version and mod loader than
main, so it is meant as a starting point for discussion rather than a drop-in merge.What's here
build.gradle.kts/settings.gradle.kts).RecruitsCategoryButtonnow overridesrenderWidget()and callssuper.renderWidget(...); the naivesuper.render(...)caused infinite recursion /StackOverflowErrorwhen the group screen opened.Fidelity to the original
README,CREDITS.txt,changelog.txt,update.json, and art files are retained.Notes
main, the diff is large by nature. Happy to restructure (e.g. target a dedicated1.21.1branch) if you'd prefer.migrate_*.py/parse_errors.pyscripts are the one-off helpers used during the port; easy to drop if you'd rather not carry them.