0999312 / Corn-Delight

Farmer's Delight Addon with Corn/Maize
MIT License
10 stars 14 forks source link

Trying to integrate with Corn Delight causes `IllegalStateException: Cannot get config value before config is loaded.` #41

Closed MarbleGateKeeper closed 1 year ago

MarbleGateKeeper commented 1 year ago

Version: 1.19.2 Newest. Lib is also newest,

I tried to integrate this mod in Create Central Kitchen but it crashes. I referred Items of Corn Delight in FMLCommonSetupEvent. Usualy it should be safe.

    @SubscribeEvent
    public static void register(FMLCommonSetupEvent event) {
        event.enqueueWork(() -> {
            REGISTRY.put(BlockRegistry.CORN_CROP.get(),
                    CornDelightMovementBehaviorExtensions::harvestCorn);
        });
    }

And I referred Items of Corn Delight in in new Fluid Registry & Datagen. It should also be safe.

    CORN_SOUP = virtual(CentralKitchen.genRL("fluid/corn_soup_still"),CentralKitchen.genRL("fluid/corn_soup_still"),
                    ItemRegistry.CORN_SOUP, 250)
            .register(),
private final CreateRecipeProvider.GeneratedRecipe
            MIXING_CORN_SOUP = add(mixing("cord_soup")
                    .output(CornDelightFluidEntries.CORN_SOUP.get(), 250)
                    .require(Tags.Fluids.MILK, 250)
                    .require(ForgeItemTags.CORPS__CORN.tag)
                    .require(ForgeTags.CROPS_CABBAGE)
                    .require(Items.SUGAR)
                    .requiresHeat(HeatCondition.HEATED)),

But here they cause following exception on run.

    Caused by: java.lang.IllegalStateException: Cannot get config value before config is loaded.
This error is currently only thrown in the development environment, to avoid breaking published mods.
In a future version, this will also throw in the production environment.
        at com.google.common.base.Preconditions.checkState(Preconditions.java:502) ~[guava-31.0.1-jre.jar%23104!/:?] {}
        at net.minecraftforge.common.ForgeConfigSpec$ConfigValue.get(ForgeConfigSpec.java:844) ~[forge-1.19.2-43.2.4_mapped_parchment_2022.11.27-1.19.2-recomp.jar%23187%23194!/:?] {re:mixin,re:classloading}
        at cn.mcmod.corn_delight.worldgen.WildCornGeneration.lambda$static$1(WildCornGeneration.java:40) ~[corn-delight-577805-4547398_mapped_parchment_2022.11.27-1.19.2.jar%23217!/:1.0.1-1.19.2] {re:classloading}
        at net.minecraftforge.registries.DeferredRegister.lambda$addEntries$1(DeferredRegister.java:388) ~[forge-1.19.2-43.2.4_mapped_parchment_2022.11.27-1.19.2-recomp.jar%23187%23194!/:?] {re:classloading}
        at net.minecraftforge.registries.RegisterEvent.register(RegisterEvent.java:61) ~[forge-1.19.2-43.2.4_mapped_parchment_2022.11.27-1.19.2-recomp.jar%23187%23194!/:?] {re:classloading,pl:eventbus:A}
        at net.minecraftforge.registries.DeferredRegister.addEntries(DeferredRegister.java:388) ~[forge-1.19.2-43.2.4_mapped_parchment_2022.11.27-1.19.2-recomp.jar%23187%23194!/:?] {re:classloading}
        at net.minecraftforge.registries.DeferredRegister$EventDispatcher.handleEvent(DeferredRegister.java:330) ~[forge-1.19.2-43.2.4_mapped_parchment_2022.11.27-1.19.2-recomp.jar%23187%23194!/:?] {re:classloading}
        at net.minecraftforge.registries.__EventDispatcher_handleEvent_RegisterEvent.invoke(.dynamic) ~[forge-1.19.2-43.2.4_mapped_parchment_2022.11.27-1.19.2-recomp.jar%23187%23194!/:?] {re:classloading,pl:eventbus:B}
        at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23113!/:?] {}
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23113!/:?] {}
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23113!/:?] {}
        at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:107) ~[javafmllanguage-1.19.2-43.2.4.jar%23189!/:?] {}
        ... 31 more
0999312 commented 1 year ago

Copy, Will check soon.

0999312 commented 1 year ago

Updated 1.0.2-1.19.2

HanatakeYurii commented 1 year ago

From @MarbleGateKeeper of Create Central Kitchen, it seems this is still not fixed:

Nope. Issue still arises in newest version.

0999312 commented 1 year ago

https://legacy.curseforge.com/minecraft/mc-mods/corn-delight/files/4637286 second try

MarbleGateKeeper commented 1 year ago

Fixed! Thanks!