TerraFirmaCraft

TerraFirmaCraft

2M Downloads

IndexOutOfBoundsException in SimplePotRecipeCategory

tgmatos opened this issue ยท 1 comments

commented

Game version: 1.20.1
TFC Version 3.2.3
Forge: 47.2.20, 47.2.30

I have been playing TFC for a while and I found a bug that was introduced in d94bcb5, on function SimplePotRecipeCategory.setRecipe. The issue #2712 maybe references this bug.

I would create a PR with a fix using iterators on the list so it would not be possible to try access an out of bounds index, but I don't know if this would be the correct fix.

Crash log:

[30May2024 20:55:38.227] [Render thread/ERROR] [mezz.jei.library.util.IngredientSupplierHelper/]: Found a broken recipe, failed to setRecipe with RecipeLayoutBuilder: Firmalife firmalife:pot/tomato_sauce class net.dries007.tfc.common.recipes.SimplePotRecipe

java.lang.IndexOutOfBoundsException: Index 3 out of bounds for length 3
	at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) ~[?:?]
	at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) ~[?:?]
	at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266) ~[?:?]
	at java.util.Objects.checkIndex(Objects.java:361) ~[?:?]
	at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
	at net.dries007.tfc.compat.jei.category.SimplePotRecipeCategory.setRecipe(SimplePotRecipeCategory.java:72) ~[TerraFirmaCraft-Forge-1.20.1-3.2.3.jar%23187!/:3.2.3]
	at net.dries007.tfc.compat.jei.category.SimplePotRecipeCategory.setRecipe(SimplePotRecipeCategory.java:29) ~[TerraFirmaCraft-Forge-1.20.1-3.2.3.jar%23187!/:3.2.3]
	at mezz.jei.library.util.IngredientSupplierHelper.getIngredientSupplier(IngredientSupplierHelper.java:22) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.library.recipes.RecipeManagerInternal.lambda$addRecipes$0(RecipeManagerInternal.java:120) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178) ~[?:?]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260) ~[?:?]
	at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616) ~[?:?]
	at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622) ~[?:?]
	at java.util.stream.ReferencePipeline.toList(ReferencePipeline.java:627) ~[?:?]
	at mezz.jei.library.recipes.RecipeManagerInternal.addRecipes(RecipeManagerInternal.java:126) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.library.recipes.RecipeManagerInternal.addRecipes(RecipeManagerInternal.java:108) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.library.load.registration.RecipeRegistration.addRecipes(RecipeRegistration.java:64) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at net.dries007.tfc.compat.jei.JEIIntegration.registerRecipes(JEIIntegration.java:158) ~[TerraFirmaCraft-Forge-1.20.1-3.2.3.jar%23187!/:3.2.3]
	at mezz.jei.library.load.PluginLoader.lambda$createRecipeManager$10(PluginLoader.java:146) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.library.load.PluginCaller.callOnPlugins(PluginCaller.java:27) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.library.load.PluginLoader.createRecipeManager(PluginLoader.java:146) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.library.startup.JeiStarter.start(JeiStarter.java:132) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.forge.startup.StartEventObserver.transitionState(StartEventObserver.java:137) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at mezz.jei.forge.startup.StartEventObserver.onEvent(StartEventObserver.java:100) ~[jei-1.20.1-forge-15.3.0.4.jar%23179!/:15.3.0.4]
	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:260) ~[eventbus-6.0.5.jar%23129!/:?]
	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:252) ~[eventbus-6.0.5.jar%23129!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%23129!/:?]
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%23129!/:?]
	at net.minecraft.client.multiplayer.ClientPacketListener.m_5859_(ClientPacketListener.java:1451) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket.m_5797_(ClientboundUpdateTagsPacket.java:35) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket.m_5797_(ClientboundUpdateTagsPacket.java:11) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.network.protocol.PacketUtils.m_263899_(PacketUtils.java:22) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.m_6367_(BlockableEventLoop.java:156) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.util.thread.ReentrantBlockableEventLoop.m_6367_(ReentrantBlockableEventLoop.java:23) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.m_7245_(BlockableEventLoop.java:130) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.util.thread.BlockableEventLoop.m_18699_(BlockableEventLoop.java:115) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1106) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:718) ~[client-1.20.1-20230612.114412-srg.jar%23188!/:?]
	at net.minecraft.client.main.Main.main(Main.java:218) ~[minecraft-1.20.1-client.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.minecraftforge.fml.loading.targets.CommonLaunchHandler.runTarget(CommonLaunchHandler.java:126) ~[loader-47.2.2.jar:47.2]
	at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.clientService(CommonLaunchHandler.java:114) ~[loader-47.2.2.jar:47.2]
	at net.minecraftforge.fml.loading.targets.CommonClientLaunchHandler.runService(CommonClientLaunchHandler.java:24) ~[loader-47.2.2.jar:47.2]
	at net.minecraftforge.fml.loading.targets.CommonLaunchHandler.lambda$launchService$4(CommonLaunchHandler.java:108) ~[loader-47.2.2.jar:47.2]
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:30) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:108) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:78) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) ~[modlauncher-10.0.9.jar:?]
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:141) ~[bootstraplauncher-1.1.2.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 io.github.zekerzhayard.forgewrapper.installer.Main.main(Main.java:67) ~[?:?]
	at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:100) ~[?:?]
	at org.prismlauncher.EntryPoint.listen(EntryPoint.java:129) ~[?:?]
	at org.prismlauncher.EntryPoint.main(EntryPoint.java:70) ~[?:?]

Let me know if you need any more information.

commented

Duplicate of #2712