Growthcraft Community Edition

Growthcraft Community Edition

1M Downloads

[4.1.1.500] (forked) Crash due to null ItemKeySchema passed in UserFermentingRecipe

VonZeeple opened this issue ยท 9 comments

commented

I'm working on a forked version of Growthcraft (synced with 4.1.1). During the initialization of user fermenting recipes, forge crashes because a null ItemKeySchema is passed in UserFermentingRecipe (for example with the poisoned cider recipe). There is indeed a @nonnull keyword in frond of ItemKeySchema itemSchema. I don't know why it is working for anyone else however.

commented

Hi I regenerated the config, also tried with a config generated with working version. Anyway it appends before generating the files, when UserFermentingRecipe is called by UserFermentingRecipesConfig.addDefaultSchemas with a null ItemKeySchema. The null argument is explicitly passed by addFallbackDefault when generating the poisoned apple juice recipe.

commented

net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Growthcraft Apples (growthcraft_apples)
Caused by: java.lang.IllegalArgumentException: Argument for @nonnull parameter 'itemSchema' of growthcraft/cellar/shared/processing/fermenting/user/UserFermentingRecipe. must not be null
at growthcraft.cellar.shared.processing.fermenting.user.UserFermentingRecipe.$$$reportNull$$$0(UserFermentingRecipe.java)
at growthcraft.cellar.shared.processing.fermenting.user.UserFermentingRecipe.(UserFermentingRecipe.java)
at growthcraft.cellar.shared.processing.fermenting.user.UserFermentingRecipesConfig.addDefaultSchemas(UserFermentingRecipesConfig.java:24)
at growthcraft.cellar.shared.processing.fermenting.user.UserFermentingRecipesConfig.addFallbackDefault(UserFermentingRecipesConfig.java:54)
at growthcraft.cellar.shared.booze.UserApiCellarBoozeBuilder.fermentsFromFallback(UserApiCellarBoozeBuilder.java:73)
at growthcraft.apples.common.Init.registerFermentations(Init.java:352)
at growthcraft.apples.common.Init.initBoozes(Init.java:254)
at growthcraft.apples.GrowthcraftApples.init(GrowthcraftApples.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:626)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:218)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:196)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)
at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)
at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)
at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)
at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)
at com.google.common.eventbus.EventBus.post(EventBus.java:217)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
at net.minecraftforge.fml.common.Loader.initializeMods(Loader.java:744)
at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:336)
at net.minecraft.client.Minecraft.init(Minecraft.java:582)
at net.minecraft.client.Minecraft.run(Minecraft.java:422)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:25)

commented

@VonZeeple Remove (or backup if you'd like, but make sure they're not in the growthcraft config) the json recipes and let Growthcraft regenerate them, if it crashes again you'll need to provide the full log file.

Since it crashes in the UserFermentingRecipe this is likely caused by a misconfigured user recipe

commented

@VonZeeple I'm really not sure what recipe is trying to load to cause that, I'm also not all that familiar with the 1.12 codebase, so the best I can suggest at moment, add some logging lines in registerFermentations and print each recipe name/id until you find the one that crashes it.

Also sorry for the late reply, been a busy busy first 2 weeks at work

commented

this is due to the fallback recipe for the poisoned cider (line 352 in apples\common\Init). A fallback recipe doesn't accept an input item. So addFallbackDefault(@nonnull Object inputFluid, @nonnull FluidStack outputFluid, int time) in UserFermentingRecipesConfig passes a null item. This happens before the generation of the config files. It is quite clear what doesn't work in the code, i'm just confused by the fact that it seems to work on your side.

commented

@VonZeeple Very odd indeed, I've only worked on the 1.7 codebase, but from what I can remember, we didn't have fallbacks at the time, I guess you can just comment out the line for now, though you may encounter several more similar cases later, gather all of them up if you can.

@Alatyami Can you shed any light on this fallback issue?

commented

I think their is a problem with @nonnull annotation about everywhere in the code, for example in ItemTest:

public static boolean isValid(@Nonnull ItemStack stack) { if (stack == null) return false; if (stack.getItem() == null) return false; if (stack.isEmpty()) return false; return true; }

Also the case for findItemSlots(@nonnull IInventory inv, @nonnull List expected, @nonnull int[] slotsSlice)
crashing due to:

public int[] findItemSlots(@Nonnull IInventory inv, @Nonnull List expected) { return findItemSlots(inv, expected, null); }

commented

In isValid it should be safe to remove the annotation, because there is an if with null check. Probably it is a copy&paste issue from my side.

commented

I updated IntelliJ and I now work on a fresh fork, and i don't have this error anymore... maybe there were a problem with my compiler...