Nevermind, misread the post.
Still may apply to some people interested in NMS or who use maven
I know this was marked as solved but questions like this come up a lot.
Hopefully this helps explains some things.
First you'll need to install the latest remapped jar to your local repository I use buildtools for this.
you can create a simple script to automate the update process:
Code:
java -jar buildtools.jar --remapped
read -p "press any key to exit"
This will contain the (for development purposes only) remapped (vanilla + spigot) jar where using mojang mappings the method names, classes and packages (but not fields) have been de-obfuscated.
now that the latest remapped spigot jar has been installed we'll need to head over to our maven project and install the
special source
plugin
The job of the special source plugin is to take
your code (compiled against the remapped jar) and refactor it so that when we install it to a non-remapped server all of the methods and fields will line up.
For instance, if the code you compiled invoked
net.minecraft.somepackage.SomeClass.someMethod()
It wouldn't find any of that in the non-remapped server because
net.minecraft.somepackage.SomeClass.someMethod()
would have been obfuscated to something like
abc.a()
An example configuration of special source:
Code:
<!-- Special Source -->
<plugin>
<groupId>net.md-5</groupId>
<artifactId>specialsource-maven-plugin</artifactId>
<version>1.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-obf</id>
<configuration>
<srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
<reverse>true</reverse>
<remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
<remappedArtifactAttached>true</remappedArtifactAttached>
<remappedClassifierName>remapped-obf</remappedClassifierName>
</configuration>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>remap</goal>
</goals>
<id>remap-spigot</id>
<configuration>
<inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
<srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
<remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
</configuration>
</execution>
</executions>
</plugin>
After this you'll need to add the remapped jar to your dependencies:
Code:
<!-- Spigot -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version>
<classifier>remapped-mojang</classifier>
<scope>provided</scope>
</dependency>
A quick note on the output binaries:
You'll see 3 new files
something.jar
something-remapped.jar
and
something-remapped-obf.jar
The one you'll want to use will be
something.jar
This will be your fully re-obfuscated jar compatible with non-remapped servers.
Some pitfalls:
- If maven can't find the remapped jar make sure that the maven install being used by buildtools is pointing to the same local repository that you are trying to get it from.
- If you also use reflection in your project you may find in some conditions the code isn't obfuscated properly, for example:
getClass("net.minecraft.world.entity." + entityClassName)
isn't reobfuscated properly because the value is decided at runtime.
- I'll think of something else?
Hope this helps some people.