PaperMC / paperweight

Gradle build system plugin for Paper and Paper forks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shading reobf artifacts into userdev project jar results in issues from double remapping

DaRacci opened this issue · comments

commented

When using the commandAPI shade dep the reobfJar task changes the class import of ResourceManager to IResourceManager.
The source of the class: https://github.com/JorelAli/CommandAPI/blob/master/CommandAPI/commandapi-1.18.2/src/main/java/dev/jorel/commandapi/nms/NMS_1_18_R2.java
I believe this might have something to do with that plugin being complied with the spigot nms maps.

See the two attached classes for the non reobf and then the broken reobf.
https://drive.google.com/drive/folders/1ev7YNMG7I1vG3IqkmI2iZEmTWtivNVpu?usp=sharing

You're shading something which is already reobfed into your jar which is being reobfed - this will cause issues as some Spigot names match Mojang names but for different classes. This can cause things to be double-remapped to nonsense.

Ideally, you should depend on the Mojang mapped version of any internals-accessing dependency that you shade. Alternatively, you can have a separate subproject that shades your internals module (already reobfed) and the CommandAPI reobf artifact.

Long-term it would be nice to have a better mechanism to handle legacy artifacts like this, but it's not at all a simple issue, so the aforementioned solutions will have to do for the foreseeable future.