MinecraftXwinP
-
Posts
4 -
Joined
-
Last visited
Posts posted by MinecraftXwinP
-
-
Hello @ChampionAsh5357, thank you for your reply!
On 4/12/2021 at 12:27 AM, ChampionAsh5357 said:There's no evidence that you use a newer version of netty within the buildscript.
I do not use the newer version of netty directly. It's a transitive dependency of Discord4j:
+--- com.discord4j:discord4j-core:3.1.3 | +--- io.projectreactor:reactor-bom:Dysprosium-SR15 | | ... | +--- com.discord4j:discord-json:1.5.6 | | ... | +--- com.discord4j:discord4j-rest:3.1.3 | | ... | | \--- com.discord4j:discord4j-common:3.1.3 | | +--- io.projectreactor:reactor-bom:Dysprosium-SR15 (*) | | +--- com.discord4j:discord-json:1.5.6 (*) | | +--- io.projectreactor.netty:reactor-netty:0.9.15.RELEASE | | | +--- io.netty:netty-codec-http:4.1.54.Final
(BTW, Minecraft is using io.netty:netty-all:4.1.25.Final)
On 4/12/2021 at 12:27 AM, ChampionAsh5357 said:You indeed shadow the version during building, but you do not compile it for use within the game
I thought those line will extend "compile" by "shadow" configuration, making "compile" inherit dependencies from "shaodw":
But anyway, I tried. I added netty dependency to the buildscript and found out that ./gradlew runServer is working!🎉 (the PR)
However, for intellij runs, still no luck. (I've run ./gradlew genIntellijRuns again after updating the buildscript). Starting server by IDE runs will still throw java.lang.NoSuchMethodError, indicating those runs are still using old version of netty.
I still wish I can launch server by IDE runs so I can use IDE's debug utilities.
-
Hello,
I have a mod that use a external library Discord4j. I read posts about using external libraries with mods and successfully used the Gradle shadow plugin to shade the library into my mod.
Discord4j seems to use a newer version of Netty. So I shaded newer version of netty and relocate the package to avoid conflict with Minecraft/Forge. The built mod (shadow jar) can run on the server.
However, I still cannot run the server through my IDE directly, neither through generated Intellij run configurations or the runServer task (./gradlew runServer)
Running the server through IDE will throw this exception:
[15:43:59] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception java.lang.NoSuchMethodError: 'boolean io.netty.handler.ssl.SslProvider.isAlpnSupported(io.netty.handler.ssl.SslProvider)' at reactor.netty.http.client.HttpClientSecure.<clinit>(HttpClientSecure.java:79) ~[reactor-netty-0.9.15.RELEASE.jar:0.9.15.RELEASE] {} at reactor.netty.http.client.HttpClient.secure(HttpClient.java:1073) ~[reactor-netty-0.9.15.RELEASE.jar:0.9.15.RELEASE] {} at discord4j.common.ReactorResources.lambda$static$0(ReactorResources.java:41) ~[discord4j-common-3.1.3.jar:3.1.3] {} at discord4j.common.ReactorResources.<init>(ReactorResources.java:54) ~[discord4j-common-3.1.3.jar:3.1.3] {} at discord4j.rest.RestClientBuilder.initReactorResources(RestClientBuilder.java:262) ~[discord4j-rest-3.1.3.jar:3.1.3] {} at discord4j.rest.RestClientBuilder.build(RestClientBuilder.java:243) ~[discord4j-rest-3.1.3.jar:3.1.3] {} at discord4j.core.DiscordClientBuilder.build(DiscordClientBuilder.java:85) ~[discord4j-core-3.1.3.jar:3.1.3] {} at discord4j.core.DiscordClientBuilder.build(DiscordClientBuilder.java:73) ~[discord4j-core-3.1.3.jar:3.1.3] {} at discord4j.core.DiscordClient.create(DiscordClient.java:59) ~[discord4j-core-3.1.3.jar:3.1.3] {re:classloading} at com.github.tony84727.xptweak.XpTweakConfig.getDiscordClient(XpTweakConfig.java:19) ~[main/:?] {re:classloading} at com.github.tony84727.xptweak.ModEventListener.onModConfig(ModEventListener.java:42) ~[main/:?] {re:classloading}
Which means Discord4j is using the older version shipped with Minecraft and isAlpnSupported method isn't available.
Is there any way to do shading and relocation in the IDE runs?
Here's the gradle file of the mod: https://github.com/tony84727/xp-tweak/blob/7f24df8f46f78840d145605db1d2cfdd988ef66b/build.gradle
Any help or pointer is appreciated. Thanks!
-
On 8/5/2019 at 12:49 AM, diesieben07 said:
All I can suggest at this point is to delete the gradle cache (.gradle in your user home).
Deleting the cache does the trick. Thank you!
How to apply relocate for intellij runs or runServer?
in Modder Support
Posted
My bad, after modifying a build script, IDE need to sync with gradle again to rebuild the model or module(?). After syncing, the IDE runs works.
Although, I'm still not sure what happened. I guess it's because when explicitly adding the netty dependency into the dependencies block, gradle will prefer newer version over the original version used by Minecraft?
The final working buildscript for me is: https://github.com/tony84727/xp-tweak/blob/14c629e3e582beed0d620313a291cd2b54273220/build.gradle