[Solved] Sponge plugin with forge mod enhancement


#1

Let me first explain what I am trying to accomplish.

I would like to create a Sponge chat plugin. The core functionality will be written within sponge. Though some features I would like to add are only possible with Forge. This has led me to come up with the idea of splitting functionality between Sponge and Forge. But this enhancement with forge is optional, you should not require a forge server nor should the client be require to have the client mod installed.

All of this is already working, but the current situation requires me to build the jars, deploy them onto my local server and start the server manually. This is not the ideal setup as you can’t edit live code because live forge/minecraft is obfuscated.

So my goal is to setup the development environment in IntelliJ to allow me to just hit the debug button, start the server and edit live code.

In this repo you can find my current “blank” setup. It doesn’t have any code, only the configuration. Running the client works fine so this can be ignored. If you run the server (tested with IntelliJ and gradlew :server-forge:runServer I get the following error.

Error message
Mixin apply failed mixins.common.core.json:server.PlayerListAccessor -> net.minecraft.server.management.PlayerList: org.spongepowered.asm.mixin.gen.throwables.InvalidAccessorException No candidates were found matching :Lorg/apache/logging/log4j/Logger; in net/minecraft/server/management/PlayerList for mixins.common.core.json:server.PlayerListAccessor->@Accessor[FIELD_GETTER]::accessor$getPlayerListLogger()Lorg/apache/logging/log4j/Logger;
org.spongepowered.asm.mixin.gen.throwables.InvalidAccessorException: No candidates were found matching :Lorg/apache/logging/log4j/Logger; in net/minecraft/server/management/PlayerList for mixins.common.core.json:server.PlayerListAccessor->@Accessor[FIELD_GETTER]::accessor$getPlayerListLogger()Lorg/apache/logging/log4j/Logger;
	at org.spongepowered.asm.mixin.gen.AccessorInfo.findTarget(AccessorInfo.java:382) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.gen.AccessorInfo.findTargetField(AccessorInfo.java:338) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.gen.AccessorInfo.locate(AccessorInfo.java:321) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinTargetContext.generateAccessors(MixinTargetContext.java:1215) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyAccessors(MixinApplicatorStandard.java:947) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:321) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:280) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:353) ~[mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.apply(MixinTransformer.java:724) [mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.applyMixins(MixinTransformer.java:703) [mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:509) [mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at org.spongepowered.asm.mixin.transformer.Proxy.transform(Proxy.java:72) [mixin-0.7.11-SNAPSHOT.jar:0.7.11-SNAPSHOT+unknown-b0.git-unknown]
	at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176) [launchwrapper-1.12.jar:?]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [?:1.8.0_202]
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [?:1.8.0_202]
	at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:1.8.0_202]
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) [?:1.8.0_202]
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048) [?:1.8.0_202]
	at java.lang.Class.getMethod0(Class.java:3018) [?:1.8.0_202]
	at java.lang.Class.getMethod(Class.java:1784) [?:1.8.0_202]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:132) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_202]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_202]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_202]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_202]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStartServer.main(GradleStartServer.java:10) [start/:?]

The relevant info for this setup is the following:

  • The project has no code in it to make sure we only test the setup and not the implementation.
  • My project uses the SpongeForge dev-shaded on runtime as Forge/Minecraft will be running in a dobfuscated state (at least that is what I believe).
  • To be sure I have tried the run it with the “normal” SpongeForge jar which gave the error it can’t find func_71247_a which does confirm we are running in a deobfuscated environment.
  • I have the same forge version & mapping compared to the manifest file in the SpongeForge jar

As far as I can tell, the logger field is present but it is a private static field. I am not very familiar with mixin so I am not sure if that is relevant.

Any help would be appreciated. As mentioned, this setup work but lacks the easy development tools like live debugging en code swaps, this is what I am trying to solve.


#2

I haven’t reviewed your setup completely but I wonder whether replacing the dev-shaded classifier with dev may fix this.
Here:


#3

That fixed the issue! This will make my life a lot easier, thank you Simon