feat: support all fabric server versions#1719
Conversation
Test Results 56 files ±0 56 suites ±0 2m 17s ⏱️ -28s Results for commit 767e0f8. ± Comparison against base commit d15bed0. This pull request removes 36 and adds 36 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
| .dropWhile(stackFrame -> { | ||
| var className = stackFrame.getClassName(); | ||
| var isEntrypointClass = className.contains(".Generated") && className.endsWith("Entrypoint"); | ||
| return !isEntrypointClass; | ||
| }) |
There was a problem hiding this comment.
drive-by improvement: due to the new extra reflection call when loading platform plugins, this method now needs to skip 3 frames. To make it resiliant against future changes, I changed it to actually searching the entrypoint class instead.
There was a problem hiding this comment.
This change is needed due to the shadow update. It doesn't seem to be the case anymore that classes override each other in the way they did before, therefore, I just added this extra step that just uses reflection to call the runtime methods instead. Should not make a performance difference really.
|
|
||
| # plugins | ||
| shadow = "8.3.8" | ||
| shadow = "9.0.1" |
There was a problem hiding this comment.
Update is needed as v9 is actually capable of copying jar files into the final fat jar instead of unpacking them.
| dependencies = { | ||
| @Dependency(name = "fabricloader", version = ">=0.16.6"), | ||
| @Dependency(name = "minecraft", version = "~1.21.6"), | ||
| @Dependency(name = "fabricloader", version = ">=0.17.0"), |
There was a problem hiding this comment.
v0.17 is needed due to our fallback version getter (FabricLoader.getInstance().getRawGameVersion()) which was introduced in that version.
| @@ -31,7 +31,7 @@ | |||
| version = "@version@", | |||
| dependencies = { | |||
| @Dependency(name = "fabricloader", version = ">=0.16.6"), | |||
There was a problem hiding this comment.
I guess we can technically drop the requirement way down (to around v0.12 iirc)
| alias(libs.plugins.spotless) | ||
| alias(libs.plugins.nexusPublish) | ||
| alias(libs.plugins.fabricLoom) apply false | ||
| alias(libs.plugins.shadow) apply false // must be here to enforce the bundled asm version |
There was a problem hiding this comment.
Somehow a way older asm version leaks into the classpath if we don't do this (previously loom provided the newer one) which causes the shadow remap operations to fail (relocation, minimizing, etc.)
Motivation
There were a lot of questions asking about support for more than the latest fabric version.
Modification
Use the nested mods feature of the fabric loader to load version-specific mods (nested mods are only loaded if possible depending on their version constraints). In all cases where no version mod is available, a fallback listener is registered on the services to mark them as online after a small delay to allow for the server to start. This comes with the downside that no player count and player data can be provided to the api, but that should not be much of a problem.
Result
All versions of minecraft (using the fabric mod loader) are now supported by the bridge module.