Sponge does not currently work with Pixelmon

I’m trying to run a Pixelmon server but run into an issue where Spongeneo and the Pixelmon mod try to export several of the same things at the same time. It causes the server to just crash. One of the things they both try loading is io.leangen.geantyref as seen in this crash here. There are other issues as well when the io.leangengeantyref is solved. This is using the Latest Spongeneo and Pixelmon for 1.21.1. Specifically Pixelmon 9.3.1 and Spongeneo 21.1.35-12.0.1

Exception in thread “main” java.lang.module.ResolutionException: Modules spongeneo.services and pixelmon export package io.leangen.geantyref to module org.spongepowered.configurate.gson
at java.base/java.lang.module.Resolver.resolveFail(Resolver.java:900)
at java.base/java.lang.module.Resolver.failTwoSuppliers(Resolver.java:814)
at java.base/java.lang.module.Resolver.checkExportSuppliers(Resolver.java:735)
at java.base/java.lang.module.Resolver.finish(Resolver.java:380)
at java.base/java.lang.module.Configuration.(Configuration.java:139)
at java.base/java.lang.module.Configuration.resolveAndBind(Configuration.java:493)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.ModuleLayerHandler.buildLayer(ModuleLayerHandler.java:75)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.buildTransformingClassLoader(TransformationServicesHandler.java:54)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:101)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:74)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.run(BootstrapLauncher.java:210)
at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:69)

org.spongepowered.configurate error pops up when using Pixelmon with other mods after relocating and or shadowing io.leangen.geantyref. I don’t know if this is more a sponge issue or Pixelmon issue.

The error is a bit of both sponge and pixelmon. The issue is both are using the library of org.spongepowered.configurate.gson. in an ideal world both would shadow relocate the libraries. Sponge doesnt do it because 1) its its own library and 2) sponge is a plugin loader and therefore its much easier for plugins to work with a none relocated library

As for a fix. There is one i can think of. If you follow the steps below, it should work (havent tested it, but i know its fixed issues with other libraries)

  1. open the sponge.jar file in a zip explorer (7zip, winrar, etc)
  2. open the mods folder
  3. open the spongemod.jar
  4. somewhere in there there should be a libraries file (typically .json)
    5)open that file
  5. remove the line for the gson library
  6. save your changes in both the spongemod.jar and the spongeneo.jar

That should make it so the boot process of sponge doesnt think it needs the gson library, but when it does use it, it uses the library from the pixelmon mod