Bovines and Buttercups (Mooblooms)

Bovines and Buttercups (Mooblooms)

72.8k Downloads

Bovines and Buttercups loads game classes too early

Sychic opened this issue ยท 6 comments

commented

The Bovies and Buttercups preLaunch entrypoint is causing game classes to be loaded (because of among others, this reference to Registry in a method signature), which is heavily discouraged because it can easily break things.

This is the cause of essential crashing with Bovines and Buttercups because essential loads its mixins and MixinExtras version in its preLaunch entrypoint, but if that happens to execute after Bovines and Buttercups' preLaunch, then Mixin and a (potentially older) MixinExtras version will have already been initialized and Essential's (potentially newer) MixinExtras version will be unable to register itself:

[10:41:20] [main/WARN]: Failed to select mixin config: mixins.essential.json
java.lang.reflect.UndeclaredThrowableException: null
	at knot/jdk.proxy2/jdk.proxy2.$Proxy28.offerPackage(Unknown Source) ~[?:?]
	at knot/gg.essential.lib.mixinextras.service.MixinExtrasServiceImpl.concedeTo(MixinExtrasServiceImpl.java:84) ~[Essential%20(fabric_1.21.4).jar:?]
	at knot/gg.essential.lib.mixinextras.service.MixinExtrasService.setup(MixinExtrasService.java:39) ~[Essential%20(fabric_1.21.4).jar:?]
	at knot/gg.essential.lib.mixinextras.MixinExtrasBootstrap.init(MixinExtrasBootstrap.java:20) ~[Essential%20(fabric_1.21.4).jar:?]
	at knot/gg.essential.mixins.Plugin.onLoad(Plugin.java:94) ~[Essential%20(fabric_1.21.4).jar:?]
	at org.spongepowered.asm.mixin.transformer.PluginHandle.onLoad(PluginHandle.java:119) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
	at org.spongepowered.asm.mixin.transformer.MixinConfig.onSelect(MixinConfig.java:790) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
	at org.spongepowered.asm.mixin.transformer.MixinProcessor.selectConfigs(MixinProcessor.java:498) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
	at org.spongepowered.asm.mixin.transformer.MixinProcessor.select(MixinProcessor.java:460) ~[sponge-mixin-0.15.4+mixin.0.8.7.jar:0.15.4+mixin.0.8.7]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at gg.essential.loader.stage2.EssentialLoader.chainLoadMixins(EssentialLoader.java:190) ~[?:?]
	at gg.essential.loader.stage2.EssentialLoader.doInitialize(EssentialLoader.java:161) ~[?:?]
	at gg.essential.loader.stage2.EssentialLoaderBase.initialize(EssentialLoaderBase.java:771) ~[?:?]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at gg.essential.loader.stage1.EssentialLoaderBase.initialize(EssentialLoaderBase.java:309) ~[?:?]
	at gg.essential.loader.stage1.EssentialSetupPreLaunch.onPreLaunch(EssentialSetupPreLaunch.java:23) ~[?:?]
	at knot/gg.essential.loader.stage0.EssentialSetupPreLaunch.onPreLaunch(EssentialSetupPreLaunch.java:42) ~[essential-loader-1.2.3-74bf81a1b2c9c52.jar:?]
	at net.fabricmc.loader.impl.FabricLoaderImpl.invokeEntrypoints(FabricLoaderImpl.java:399) [fabric-loader-0.16.10.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.init(Knot.java:160) [fabric-loader-0.16.10.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:68) [fabric-loader-0.16.10.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.16.10.jar:?]
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:105) [NewLaunch.jar:?]
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) [NewLaunch.jar:?]
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) [NewLaunch.jar:?]
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at knot/gg.essential.lib.mixinextras.utils.ProxyUtils.lambda$getProxy$1(ProxyUtils.java:19) ~[Essential%20(fabric_1.21.4).jar:?]
	... 26 more
Caused by: java.lang.IllegalStateException: The MixinExtras service has already been selected and is initialized!
	at knot/com.llamalad7.mixinextras.service.MixinExtrasServiceImpl.requireNotInitialized(MixinExtrasServiceImpl.java:182) ~[mixinextras-0.4.1-215bdc40eef77b8f.jar:?]
	at knot/com.llamalad7.mixinextras.service.MixinExtrasServiceImpl.offerPackage(MixinExtrasServiceImpl.java:99) ~[mixinextras-0.4.1-215bdc40eef77b8f.jar:?]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[?:?]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[?:?]
	at knot/gg.essential.lib.mixinextras.utils.ProxyUtils.lambda$getProxy$1(ProxyUtils.java:19) ~[Essential%20(fabric_1.21.4).jar:?]
	... 26 more
commented

Thanks for bringing up what the actual issue is, I don't support Essential, but ig I'll fix it.

commented

It's not an issue with only Essential, this will also cause issues with other mods which relocate mixinextras.

commented

Ill see if delegating the methods inside here to a different class (so they don't get immediately loaded) will work.

Fabric's random load order makes this a really hard thing to do correctly with this setup, so moving it to regular init is not viable.

commented

Ah wait, its the signature doing it, fuck.

Ig I'll check out and see if suppliering the class is a valid fix.

commented

You cannot directly or indirectly reference anything from prelaunch which isn't explicitly designed to be loaded early. Referencing any sort of main mod class is illegal, you should have separate helpers purely for pre-init if you really need them.

commented

You cannot directly or indirectly reference anything from prelaunch which isn't explicitly designed to be loaded early. Referencing any sort of main mod class is illegal, you should have separate helpers purely for pre-init if you really need them.

Yup. I've swapped out my registration creation methods, and also moved my platform helper to main init.

Consider this fixed for the next update.