FabricMC / fabric-loom

Gradle build system plugin used to automate the setup of a minecraft mod development environment.
MIT License
225 stars 194 forks source link

Can't use integrated mixin extras #1012

Closed legoraft closed 4 months ago

legoraft commented 7 months ago

I've used mixin extras in my mod for a while, but with the new loader version I wanted to use the new integrated mixin extras. I want to use an @WrapOperation mixin, but my IDE can't find it and I don't know how to import it. Is there something I'm missing?

modmuss50 commented 7 months ago

What loom version are you using? 1.4 is required for Mixin Extras.

legoraft commented 7 months ago

I think that that's the issue, I was using 1.2

legoraft commented 7 months ago

It still isn't working even though loom is updated to 1.4-SNAPSHOT

kevinthegreat1 commented 7 months ago

are you on loader 0.15+?

legoraft commented 7 months ago

yeah in my gradle.properties I've copied the 1.20.4 versions from fabricmc and I've updated loom to 1.4. Loader is 0.15.2

Linguardium commented 7 months ago

did you reload the gradle project? ( IntelliJ: gradle tab, recycle circle. VSCode: shift+alt+u while in the build.gradle )

kevinthegreat1 commented 7 months ago

reload gradle then

legoraft commented 7 months ago

reloaded gradle, deleted all gradle and idea files and reloaded entire project, updated jdk and I think that all my versions are correct

modmuss50 commented 7 months ago

@legoraft try adding the following snippet to your build.gradle

configurations.all {
   resolutionStrategy {
     force("net.fabricmc:fabric-loader:$loader_version")
   }
}

I think loom has an issue where it may choose to use loader installer json from a version of loader from one of your depedencies in certain edge cases.

legoraft commented 7 months ago

that fixed it, prob an issue with spruceui or modmenu in that case

modmuss50 commented 7 months ago

I'll move this issue to loom.

gniftygnome commented 7 months ago

I've seen some dev env support issues for ModMenu with Loom 1.4 recently that could be mysteriously resolved like this:

    modApi("com.terraformersmc:modmenu:${project.modmenu_version}") {
        exclude(group: "net.fabricmc")
    }
modmuss50 commented 7 months ago

I believe I know what the issue is, fixing it isn't so easy though. I could likely put in a hack fix that will resolve it for 99% of cases.

legoraft commented 7 months ago

couldn't it be that the loom version in mod menu is 1.1, so the mixin extras isn't working corrextly when you use it as a dependency? Just taking a guess here, still trying to figure out some gradle stuff

modmuss50 commented 7 months ago

couldn't it be that the loom version in mod menu is 1.1, so the mixin extras isn't working corrextly when you use it as a dependency? Just taking a guess here, still trying to figure out some gradle stuff

No, at least I dont think so. What I believe is happening is as follows:

  1. Loom processes configurations (eg: modApi, modImplementation) separately.
  2. While doing so, it keeps an eye out for any jar containing a fabric-installer.json file.
  3. It reads the first installer json file it finds, here lies the issue.
  4. In this case here loom may have processed modApi before modImplementation, thus using the fabric-installer.json file from the latest version of fabric loader on the modApi configuration.

Ideally it should find the latest version of fabric-loader on all of the mod* configurations, however im not too sure how easy this is to do. Worse case I can just force it to check modImplementation first as this is where I expect 99% of people define their loader version.

gniftygnome commented 7 months ago

Worse case I can just force it to check modImplementation first as this is where I expect 99% of people define their loader version.

Makes sense. Probably 99.44%, no less.

modmuss50 commented 4 months ago

This was vastly improved to a point where I havent seen anyone have any issue with it, there isnt a lot more I can do easily to fully fix it.