Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabric API Mixin apply InvalidInjectionException in dev environment #72

Open
jeseibel opened this issue Apr 17, 2024 · 3 comments
Open
Labels
bug Something isn't working priority: high breaks prod, or other big issue

Comments

@jeseibel
Copy link

Background

I'm trying to convert Distant Horizons, a multi loader (forge, neo, and fabric) project, from Architectury to Unimined and recently ran into an issue.

Issue

I'm able to run all 3 loaders in retail MC without issue and forge/neo via gradle (./gradlew forge:runClient / ./gradlew neoforge:runClient); but attempting to run the fabric version via gradle (./gradlew fabric:runClient) causes the game to crash due to a failed fabric API mixin.

[20:51:58] [Render thread/WARN]: Error loading class: net/minecraft/client/render/WorldRenderer (java.lang.ClassNotFoundException: net/minecraft/client/render/WorldRenderer)
[20:51:58] [Render thread/ERROR]: Mixin apply for mod fabric-rendering-v1 failed fabric-rendering-v1.mixins.json:WorldRendererMixin from mod fabric-rendering-v1 -> net.minecraft.client.renderer.LevelRenderer: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException @Inject annotation on onReload specifies a target class 'net/minecraft/client/render/WorldRenderer', which is not supported [PREINJECT Applicator Phase -> fabric-rendering-v1.mixins.json:WorldRendererMixin from mod fabric-rendering-v1 -> Prepare Injections ->  -> handler$zzk000$fabric-rendering-v1$onReload(Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> Parse]
org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @Inject annotation on onReload specifies a target class 'net/minecraft/client/render/WorldRenderer', which is not supported [PREINJECT Applicator Phase -> fabric-rendering-v1.mixins.json:WorldRendererMixin from mod fabric-rendering-v1 -> Prepare Injections ->  -> handler$zzk000$fabric-rendering-v1$onReload(Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> Parse]
	at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.parseSelectors(InjectionInfo.java:355) ~[sponge-mixin-0.12.5+mixin.0.8.5.jar:0.12.5+mixin.0.8.5]

Full crash log:
latest.log

Attempted Fixes

I've tried:

  • Running in different versions of Minecraft
    • Specifically 1.20.4, 1.20.2, 1.20.1, and 1.19.4
  • Updating the fabric API to the latest version
  • Update the fabric loader to the latest version
  • Using different Unimined versions (0.1.2-SNAPSHOT, 1.2.0, 1.2.0-SNAPSHOT)
  • Clearing my gradle cache
  • Compiling/running on a different computer

In every test I saw exactly the same error.

If I comment out the fabric-rendering-v1 line in our fabric build.gradle file (and its references in code), the game runs normally. Unfortunately we kinda need that for our code to work. 😉

Related Build Files

main gradle files:
gradle.properties.txt
build.gradle.txt
settings.gradle.txt

Fabric gradle file:
build.gradle.txt

If you need a minimal reproduction case please let me know.

Moving Forward

I'm a bit concerned/confused since we had Unimined working previously and after pulling down the old known-working project fresh, I got the exact same error.

Having run into this unexplained issue I'm a bit hesitant to move Distant Horizons away from Architectury, although I'm still hoping the issue is something on my end. Otherwise is it possible Unimined has a dependency that changed between all it's versions?

@wagyourtail
Copy link
Collaborator

wagyourtail commented Apr 22, 2024

ahh. I see, that is a weird mixin. specifying type on method.
image

now to figure out why

well, first off. the refmap is supposed to be remapped by fabric loader at runtime, so I disable mixin remapping on mods by default. idk where this is getting changed back.

I added

mods.modImplementation {
        mixinRemap {
            off()
        }
    }

in the fabric build.gradle of distant horizons, deleted .gradle/unimined/local/modTransform and it worked...
image

found that part fixed now 1.2.2-SNAPSHOT

still tho, that's an issue with my mixin remapper, so I'll look into it, and leave this open until I figure out why

@thecatcore
Copy link
Contributor

Recent version of Fabric-Loom stopped generating refmap (I don't remember if it's an opt-in or opt-out feature, but Fabric API definitly make use of it), now the injection signature is directly remapped at the same time as the mixin class. So that's probably related.

@wagyourtail
Copy link
Collaborator

wagyourtail commented Apr 28, 2024

yeah, that's unrelated. at least in this case

@wagyourtail wagyourtail added priority: high breaks prod, or other big issue bug Something isn't working labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: high breaks prod, or other big issue
Projects
None yet
Development

No branches or pull requests

3 participants