Create

Create

86M Downloads

Crash when viewing EnderStorage recipes

Partonetrain opened this issue ยท 5 comments

commented

Describe the Bug

When trying to render(?) EnderStorage recipes with the Mechanical Crafter, the game crashes. I assume this is because of the EnderStorage's custom RecipeTypes (enderstorage:create_recipe, enderstorage:recolour_recipe).

Stacktrace (full log attached):

---- Minecraft Crash Report ----
// You should try our sister game, Minceraft!

Time: 12/10/22, 10:13 PM
Description: Rendering screen

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at java.util.Arrays$ArrayList.get(Arrays.java:4165) ~[?:?] {}
	at net.minecraft.core.NonNullList.get(NonNullList.java:47) ~[client-1.18.2-20220404.173914-srg.jar%23167!/:?] {re:mixin,re:classloading}
	at com.simibubi.create.compat.jei.category.MechanicalCraftingCategory.draw(MechanicalCraftingCategory.java:104) ~[create-1.18.2-0.5.0.e.jar%2377!/:0.5.0.e] {re:classloading}
	at com.simibubi.create.compat.jei.category.MechanicalCraftingCategory.draw(MechanicalCraftingCategory.java:35) ~[create-1.18.2-0.5.0.e.jar%2377!/:0.5.0.e] {re:classloading}
	at mezz.jei.gui.recipes.RecipeLayout.drawRecipe(RecipeLayout.java:167) ~[jei-1.18.2-9.7.1.255.jar%23114!/:9.7.1.255] {re:classloading}
	at mezz.jei.gui.recipes.RecipesGui.m_6305_(RecipesGui.java:245) ~[jei-1.18.2-9.7.1.255.jar%23114!/:9.7.1.255] {re:classloading}
	at net.minecraftforge.client.ForgeHooksClient.drawScreenInternal(ForgeHooksClient.java:403) ~[forge-1.18.2-40.1.84-universal.jar%23172!/:?] {re:mixin,re:classloading}
	at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:396) ~[forge-1.18.2-40.1.84-universal.jar%23172!/:?] {re:mixin,re:classloading}
	at net.minecraft.client.renderer.GameRenderer.m_109093_(GameRenderer.java:890) ~[client-1.18.2-20220404.173914-srg.jar%23167!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:create.mixins.json:GameRendererMixin,pl:mixin:APP:create.mixins.json:accessor.GameRendererAccessor,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.m_91383_(Minecraft.java:1046) ~[client-1.18.2-20220404.173914-srg.jar%23167!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:neat.mixins.json:MinecraftMixin,pl:mixin:APP:bookshelf.common.mixins.json:client.AccessorMinecraft,pl:mixin:APP:balm.mixins.json:MinecraftMixin,pl:mixin:APP:konkrete.mixin.json:client.MixinMinecraft,pl:mixin:APP:architectury.mixins.json:MixinMinecraft,pl:mixin:APP:antiqueatlas-common.mixins.json:MixinMinecraftClient,pl:mixin:APP:flywheel.mixins.json:PausedPartialTickAccessor,pl:mixin:APP:iceberg.mixins.json:MinecraftMixin,pl:mixin:APP:fancymenu.general.mixin.json:MixinMinecraft,pl:mixin:APP:fancymenu.general.mixin.json:IMixinMinecraft,pl:mixin:APP:create.mixins.json:WindowResizeMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.m_91374_(Minecraft.java:665) ~[client-1.18.2-20220404.173914-srg.jar%23167!/:?] {re:mixin,pl:accesstransformer:B,pl:runtimedistcleaner:A,re:classloading,pl:accesstransformer:B,pl:mixin:APP:neat.mixins.json:MinecraftMixin,pl:mixin:APP:bookshelf.common.mixins.json:client.AccessorMinecraft,pl:mixin:APP:balm.mixins.json:MinecraftMixin,pl:mixin:APP:konkrete.mixin.json:client.MixinMinecraft,pl:mixin:APP:architectury.mixins.json:MixinMinecraft,pl:mixin:APP:antiqueatlas-common.mixins.json:MixinMinecraftClient,pl:mixin:APP:flywheel.mixins.json:PausedPartialTickAccessor,pl:mixin:APP:iceberg.mixins.json:MinecraftMixin,pl:mixin:APP:fancymenu.general.mixin.json:MixinMinecraft,pl:mixin:APP:fancymenu.general.mixin.json:IMixinMinecraft,pl:mixin:APP:create.mixins.json:WindowResizeMixin,pl:mixin:A,pl:runtimedistcleaner:A}
	at net.minecraft.client.main.Main.main(Main.java:205) ~[client-1.18.2-20220404.173914-srg.jar%23167!/:?] {re:classloading,pl:runtimedistcleaner:A}
	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.CommonClientLaunchHandler.lambda$launchService$0(CommonClientLaunchHandler.java:31) ~[fmlloader-1.18.2-40.1.84.jar%2317!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.1.3.jar%235!/:?] {}
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:149) [bootstraplauncher-1.0.0.jar:?] {}

Reproduction Steps

  1. Install EnderStorage, Create, and JEI
  2. Look at the recipe for the Ender Chest in JEI
  3. Click on the Automated Shaped Crafting tab, and crash

Expected Result

Not sure exactly because I'm not sure what recipetype is crashing, but ideally it should catch the exception instead of crashing

Screenshots and Videos

No response

Crash Report or Log

https://gist.github.com/Partonetrain/6194ae12fc339594cf5ba8278268e3bf

Operating System

Windows 10

Mod Version

0.5.0e

Minecraft Version

1.18.2

Forge Version

40.1.84

Other Mods

No response

Additional Context

No response

commented

confirmed on 1.16.5 on MultiMC with the entire "create above and beyond" modpack, at least according to this:
-- JEI render details --
Details:
Unique Id (for Blacklist): enderstorage:ender_tank
Ingredient Type: class net.minecraft.item.ItemStack
Error Info: 1 ender_tank enderstorage:ender_tank
Filter Text:
Edit Mode Enabled: false
Debug Mode Enabled: false

Though I played with two people who did not crash.

edit: I found that you can blacklist the items from appearing by going to your MC folder and going: config->jei->blacklist.cfg
Just a temporary solution though.

commented

I'm getting an identical crash (client-side only) in Minecraft 1.19.2, running Forge 43.2.3 using create-1.19.2-0.5.0.i, EnderStorage-1.19.2-2.10.1.181-universal, and jei-1.19.2-forge-11.5.2.1007

commented

After investigating, the issue occurs because EnderStorage's ReColourRecipe (the dynamic recipe to change the color of chests, tanks and pouches) reports being 3x3 but its actual ingredient list contains only one element.

A quick fix from Create's side would be to always check if the slot index is in range here:

if (!recipe.getIngredients()
.get(row * getWidth(recipe) + col)
.isEmpty()) {

This fixes the crash, but I think that fundamentally, "special" recipes should never be displayed in JEI, as it's already the case for the normal crafting table and the game's vanilla recipe book. This should probably done around here

.addTypedRecipesIf(() -> RecipeType.CRAFTING,
recipe -> recipe instanceof IShapedRecipe<?> && !AllRecipeTypes.shouldIgnoreInAutomation(recipe))

For instance:

.addTypedRecipesIf(() -> RecipeType.CRAFTING, recipe -> recipe instanceof IShapedRecipe<?>
    && !AllRecipeTypes.shouldIgnoreInAutomation(recipe)
    && !(recipe instanceof CraftingRecipe craftingRecipe && recipe.isSpecial()))

I tested the above fix and it works, but this may obviously come with disadvantages as it removes some recipes from JEI. I can send a PR for that.

commented

I was bewildered by this error too until I searched for the same issue and encountered this. Good to know there's already a fix in the works, potentially.

commented

confirmed also in 1.19.2 latest versions