srwxr-xr-x / Neutrino

A Light, exploration-based Quark Spin-Off Fabric Mod for Minecraft
GNU General Public License v3.0
5 stars 5 forks source link

[BUG] Crashes when Balm installed #26

Open GaryCXJk opened 2 years ago

GaryCXJk commented 2 years ago

Describe the bug Whenever Neutrino is installed together with the Balm library, the game crashes. The game runs normally without it.

To Reproduce Steps to reproduce the behavior:

  1. Install Fabric Loader and the Fabric API
  2. Add the Balm library (additional mods using Balm are optional)
  3. Start the game
  4. See error

Expected behavior The game runs normally.

Screenshots Not applicable

Desktop (please complete the following information):

Additional context The error log shows the current error:

Mixin apply for mod balm-fabric failed balm.mixins.json:CropBlockMixin -> net.minecraft.class_2302: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException @At("INVOKE") on net/minecraft/class_2302::randomTickPreGrow with priority 1000 cannot inject into net/minecraft/class_2302::method_9514(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;)V merged by com.frostwizard4.Neutrino.mixin.CropBlockMixin with priority 1000 [PREINJECT Applicator Phase -> balm.mixins.json:CropBlockMixin -> Prepare Injections ->  -> handler$zmk000$randomTickPreGrow(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> Prepare]
org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @At("INVOKE") on net/minecraft/class_2302::randomTickPreGrow with priority 1000 cannot inject into net/minecraft/class_2302::method_9514(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;)V merged by com.frostwizard4.Neutrino.mixin.CropBlockMixin with priority 1000 [PREINJECT Applicator Phase -> balm.mixins.json:CropBlockMixin -> Prepare Injections ->  -> handler$zmk000$randomTickPreGrow(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> Prepare]

My assumption is that it is caused by both Balm and Neutrino causing a conflict when trying to use the same mixin on the same method. No crash happens when either is installed.

Full crash report:

Mixin apply for mod balm-fabric failed balm.mixins.json:CropBlockMixin -> net.minecraft.class_2302: org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException @At("INVOKE") on net/minecraft/class_2302::randomTickPreGrow with priority 1000 cannot inject into net/minecraft/class_2302::method_9514(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;)V merged by com.frostwizard4.Neutrino.mixin.CropBlockMixin with priority 1000 [PREINJECT Applicator Phase -> balm.mixins.json:CropBlockMixin -> Prepare Injections ->  -> handler$zmk000$randomTickPreGrow(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> Prepare]
org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionException: @At("INVOKE") on net/minecraft/class_2302::randomTickPreGrow with priority 1000 cannot inject into net/minecraft/class_2302::method_9514(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;)V merged by com.frostwizard4.Neutrino.mixin.CropBlockMixin with priority 1000 [PREINJECT Applicator Phase -> balm.mixins.json:CropBlockMixin -> Prepare Injections ->  -> handler$zmk000$randomTickPreGrow(Lnet/minecraft/class_2680;Lnet/minecraft/class_3218;Lnet/minecraft/class_2338;Ljava/util/Random;Lorg/spongepowered/asm/mixin/injection/callback/CallbackInfo;)V -> Prepare]
    at org.spongepowered.asm.mixin.injection.code.Injector.findTargetNodes(Injector.java:305) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.injection.code.Injector.find(Injector.java:240) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.injection.struct.InjectionInfo.prepare(InjectionInfo.java:421) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinTargetContext.prepareInjections(MixinTargetContext.java:1338) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.prepareInjections(MixinApplicatorStandard.java:1043) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.applyMixin(MixinApplicatorStandard.java:393) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinApplicatorStandard.apply(MixinApplicatorStandard.java:325) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.TargetClassContext.apply(TargetClassContext.java:421) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.TargetClassContext.applyMixins(TargetClassContext.java:403) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinProcessor.applyMixins(MixinProcessor.java:363) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClass(MixinTransformer.java:234) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at org.spongepowered.asm.mixin.transformer.MixinTransformer.transformClassBytes(MixinTransformer.java:202) ~[sponge-mixin-0.10.7+mixin.0.8.4.jar:0.10.7+mixin.0.8.4]
    at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.getPostMixinClassByteArray(KnotClassDelegate.java:229) ~[fabric-loader-0.12.8.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClassDelegate.tryLoadClass(KnotClassDelegate.java:136) ~[fabric-loader-0.12.8.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClassLoader.loadClass(KnotClassLoader.java:155) ~[fabric-loader-0.12.8.jar:?]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
    at net.minecraft.class_5872.<clinit>(class_5872.java:9) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_5871.method_33968(class_5871.java:16) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at com.mojang.serialization.codecs.RecordCodecBuilder.mapCodec(RecordCodecBuilder.java:76) ~[datafixerupper-4.0.26.jar:?]
    at net.minecraft.class_5871.<clinit>(class_5871.java:12) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_2939.<clinit>(class_2939.java:31) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_5463.<clinit>(class_5463.java:18) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_5458.method_30572(class_5458.java:46) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_5458.method_30566(class_5458.java:78) ~[intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) [?:?]
    at net.minecraft.class_5458.<clinit>(class_5458.java:77) [intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_2378.<clinit>(class_2378.java:269) [intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.class_2966.method_12851(class_2966.java:49) [intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:153) [intermediary-fabric-loader-0.12.8-1.18.jar:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:599) [fabric-loader-0.12.8.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77) [fabric-loader-0.12.8.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) [fabric-loader-0.12.8.jar:?]

EDIT:

After looking at the source code, it seems that Neutrino overrides the original randomTick method, which causes Balm to not be able to inject its own code (randomTickPreGrow and randomTickPostGrow).

srwxr-xr-x commented 2 years ago

You are correct about the override, I forgot I had overridden that method instead of just injecting into it, the original plan had been to inject, but I used Overrides to test and forgot to change it, will be fixed in the next version.

srwxr-xr-x commented 2 years ago

I modified the code to use an inject, but now the game constantly reloads on startup, I guess it will be fixed in the release after this net one, but it may take a while.