MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
508 stars 437 forks source link

Issues with fg.deobf #921

Closed CreativeMD closed 1 year ago

CreativeMD commented 1 year ago

Hey there,

since the update to 1.20 (upgrade to ForgeGradle 6) I'm having a few issues using fg.deobf. I used cursemaven and modrinth maven before to decompile the mod I need as a dependency. Unfortunately it does not work anymore and results in a small error: Example code: implementation fg.deobf("maven.modrinth:rubidium:0.6.5")

Error: Could not resolve: maven.modrinth:rubidium:0.6.5_mapped_official_1.20.1

Is this a bug or is my configuration wrong?

In Regards CreativeMD

gigaherz commented 1 year ago

If the missing dependency contains "mapped" in the version it means the remapping system errored earlier in the log, but Intellij likes to be helpful and trims the log, hiding the real cause. I'd recommend you use the forge discord or forums so we can troubleshoot better, instead of littering the issue tracker with user support

CreativeMD commented 1 year ago

Is it The Forge Project Discord Server? Which channel should I choose, gradle?

gigaherz commented 1 year ago

Yes to the server, no to the channel. use a modder-supoort channel. the channels in the projects category are for coordinating development of those projects, not tech support.

CreativeMD commented 1 year ago

I have looked through the code a bit and it seems like the dependency is suffix _mapped_official_1.20.1 is added by default. I guess fg.deobf triggers this method call here: https://github.com/MinecraftForge/ForgeGradle/blob/651e43fd7c68068c835548583c5eb924e13d9251/src/userdev/java/net/minecraftforge/gradle/userdev/DependencyManagementExtension.java#L59-L64 This triggers the remapper to remap the dependecy.

The remapper creates a copy of the dependency and a listener (which is called once mappings are loaded) to add the suffix _mapped_official_1.20.1. Strictly is used, which means it has to be part of the filename (according to docs):

https://github.com/MinecraftForge/ForgeGradle/blob/651e43fd7c68068c835548583c5eb924e13d9251/src/userdev/java/net/minecraftforge/gradle/userdev/util/DependencyRemapper.java#L49-L53

Here is is the listener called: https://github.com/MinecraftForge/ForgeGradle/blob/651e43fd7c68068c835548583c5eb924e13d9251/src/userdev/java/net/minecraftforge/gradle/userdev/UserDevPlugin.java#L266

I do not see how an external dependency bypasses this. All these changes were done for ForgeGradle 6, which could explain why things worked just fine in ForgeGradle 5. Or maybe I'm missing something? Do know, but there is definitely going something wrong here.

CreativeMD commented 1 year ago

I created a fork and added a new method called deobf2, which does not include the remap call (commit: https://github.com/CreativeMD/ForgeGradle/commit/f69666755f3034ae290d9f60f12135716fe5c7f0).

https://github.com/CreativeMD/ForgeGradle/blob/f69666755f3034ae290d9f60f12135716fe5c7f0/src/userdev/java/net/minecraftforge/gradle/userdev/DependencyManagementExtension.java#L66-L71

Tested it in my local environment and it solves the issue. The error Could not resolve: maven.modrinth:rubidium:0.6.5_mapped_official_1.20.1 is not there anymore. I'm not 100% sure if the file is deobfuscated. Can ForgeGradle deobfuscate mixins (because they do not work properly)?

CreativeMD commented 1 year ago

Ok I was totally off. Issue is caused by LittleFrames which requires LittleTiles. Apparently this is an issue with ForgeGradle, the issue could be easily solved by adding the same dependency LittleTiles needs to LittleFrames.