Handle Error when crop ID is spelled wrong
Kappatard opened this issue ยท 0 comments
If you spell a crop ID wrong in the configure-crops.json the mod will only make the changes before the wrong ID and will throw following error in the output log.
An error occurred while reading configure-crops.json com.google.gson.JsonParseException: Invalid crop id provided: mysticalagriculture:platnum at TRANSFORMER/[email protected]/com.blakebr0.mysticalcustomization.loader.CropLoader.lambda$onPostRegisterCrops$2(CropLoader.java:121) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at TRANSFORMER/[email protected]/com.blakebr0.mysticalcustomization.loader.CropLoader.onPostRegisterCrops(CropLoader.java:114) at TRANSFORMER/[email protected]/com.blakebr0.mysticalcustomization.lib.ModCorePlugin.onPostRegisterCrops(ModCorePlugin.java:27) at TRANSFORMER/[email protected]/com.blakebr0.mysticalagriculture.registry.CropRegistry.lambda$onRegisterItems$9(CropRegistry.java:168) at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721) at TRANSFORMER/[email protected]/com.blakebr0.mysticalagriculture.registry.PluginRegistry.forEach(PluginRegistry.java:52) at TRANSFORMER/[email protected]/com.blakebr0.mysticalagriculture.registry.CropRegistry.onRegisterItems(CropRegistry.java:168) at TRANSFORMER/[email protected]/com.blakebr0.mysticalagriculture.init.ModItems.lambda$onRegisterItems$123(ModItems.java:251) at TRANSFORMER/[email protected]/net.minecraftforge.registries.RegisterEvent.register(RegisterEvent.java:76) at TRANSFORMER/[email protected]/com.blakebr0.mysticalagriculture.init.ModItems.onRegisterItems(ModItems.java:241) at TRANSFORMER/[email protected]/com.blakebr0.mysticalagriculture.init.__ModItems_onRegisterItems_RegisterEvent.invoke(.dynamic) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(FMLModContainer.java:107) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$postEventWithWrapInModOrder$33(ModLoader.java:346) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModList.forEachModInOrder(ModList.java:227) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.postEventWithWrapInModOrder(ModLoader.java:344) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.postEventWrapContainerInModOrder(ModLoader.java:337) at TRANSFORMER/[email protected]/net.minecraftforge.registries.GameData.postRegisterEvents(GameData.java:342) at TRANSFORMER/[email protected]/net.minecraftforge.common.ForgeStatesProvider.lambda$new$4(ForgeStatesProvider.java:25) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.handleInlineTransition(ModLoader.java:217) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$dispatchAndHandleError$19(ModLoader.java:209) at java.base/java.util.Optional.ifPresent(Optional.java:178) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.dispatchAndHandleError(ModLoader.java:209) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.lambda$gatherAndInitializeMods$13(ModLoader.java:183) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModLoader.gatherAndInitializeMods(ModLoader.java:183) at TRANSFORMER/[email protected]/net.minecraftforge.client.loading.ClientModLoader.lambda$begin$1(ClientModLoader.java:70) at TRANSFORMER/[email protected]/net.minecraftforge.client.loading.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:90) at TRANSFORMER/[email protected]/net.minecraftforge.client.loading.ClientModLoader.begin(ClientModLoader.java:70) at TRANSFORMER/[email protected]/net.minecraft.client.Minecraft.<init>(Minecraft.java:459) at TRANSFORMER/[email protected]/net.minecraft.client.main.Main.main(Main.java:182) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:111) at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:99) at MC-BOOTSTRAP/[email protected]/net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.lambda$makeService$0(CommonClientLaunchHandler.java:25) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:108) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:78) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at [email protected]/cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141)
Any changes made after this point won't be applied. Ignoring invalid IDs and continuing to make the changes after the invalid ID would probably make it faster for people to identify that they misspelled the ID. People that make changes in the config are likely to look at the logs if something doesn't work so this is not a very necessary change, but It would probably save people a little bit of time.
Here is a example JSON any seeds listed after the wrong ID wont be disabled.
configure-crops.json