architectury / architectury-plugin

A simple gradle plugin to enable developing multiplatform mods.
MIT License
56 stars 19 forks source link

@ExpectPlatform fails without architectury api #13

Closed Trikzon closed 3 years ago

Trikzon commented 3 years ago

@ExpectPlatform fails without architectury api

The ExpectPlatform annotation fails to work with the following error:

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'examplemod'!
    at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:53)
    at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke(EntrypointUtils.java:36)
    at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointClient.start(EntrypointClient.java:32)
    at net.minecraft.client.Minecraft.<init>(Minecraft.java:437)
    at net.minecraft.client.main.Main.main(Main.java:177)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:226)
    at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:139)
    at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:27)
    at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.BootstrapMethodError: bootstrap method initialization exception
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:194)
    at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:315)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:271)
    at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:261)
    at net.examplemod.ExampleExpectPlatform.getConfigDirectory(ExampleExpectPlatform.java)
    at net.examplemod.ExampleMod.init(ExampleMod.java:7)
    at net.examplemod.fabric.ExampleModFabric.onInitialize(ExampleModFabric.java:9)
    at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:50)
    ... 12 more
Caused by: java.lang.IllegalStateException: No detected mod loader!
    at architectury_inject_architecturyexamplemod_common_80e7ac06d9504ad5a0a5229042c19c45.PlatformMethods.getModLoader(PlatformMethods.java:56)
    at architectury_inject_architecturyexamplemod_common_80e7ac06d9504ad5a0a5229042c19c45.PlatformMethods.platform(PlatformMethods.java:14)
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:206)
    at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:90)
    ... 19 more

The key part is No detected mod loader! which can be found in PlatformMethods in architectury-plugin.

Steps to Reproduce

  1. Download architectury-example-mod
  2. Remove architectury api as a dependency in the forge, fabric, and common modules.
  3. Remove all architectury api references from the code
  4. Run and get that crash

Test repository

I made a repository that uses the architectury-example-mod and only removes the architectury api. It crashes.

That can be found here for your testing: https://github.com/Trikzon/expect-platform-test .

That repo will be deleted after this issue is solved.