bluelightning32 / vs-gourmand

Vintage story mod to give a health buff for eating a greater variety of foods
MIT License
0 stars 0 forks source link

Game crashes when opening Gourmand tab. #2

Closed Kwehlani closed 1 day ago

Kwehlani commented 1 day ago

Both upon opening my test world as well as a brand new world, my game crashes when I try to view the Gourmand tab.

Running on 64 bit Windows 10.0.22631.0 with 32693 MB RAM Game Version: v1.19.8 (Stable) 2024-10-01 4:20:03 PM: Critical error occurred in the following mod: gourmand@1.2.0 Loaded Mods: aculinaryartillery@1.2.1, game@1.19.8, expandedfoods@1.7.1, gourmand@1.2.0, creative@1.19.8, survival@1.19.8 System.IndexOutOfRangeException: Index was outside the bounds of the array. at Vintagestory.GameContent.MealMeshCache.GetPieMesh(ItemStack pieStack, ModelTransform transform) in VSSurvivalMod\Systems\Cooking\MealMeshCache.cs:line 149 at Vintagestory.GameContent.MealMeshCache.GetOrCreatePieMeshRef(ItemStack pieStack) in VSSurvivalMod\Systems\Cooking\MealMeshCache.cs:line 139 at Vintagestory.GameContent.BlockPie.OnBeforeRender(ICoreClientAPI capi, ItemStack itemstack, EnumItemRenderTarget target, ItemRenderInfo& renderinfo) in VSSurvivalMod\Block\BlockPie.cs:line 207 at Vintagestory.Client.NoObf.InventoryItemRenderer.GetItemStackRenderInfo(ClientMain game, ItemSlot inSlot, EnumItemRenderTarget target, Single dt) in VintagestoryLib\Client\Render\InventoryItemRenderer.cs:line 315 at Vintagestory.Client.NoObf.InventoryItemRenderer.RenderItemstackToGui(ItemSlot inSlot, Double posX, Double posY, Double posZ, Single size, Int32 color, Single dt, Boolean shading, Boolean origRotate, Boolean showStackSize) in VintagestoryLib\Client\Render\InventoryItemRenderer.cs:line 194 at Vintagestory.Client.NoObf.RenderAPIGame.RenderItemstackToGui(ItemSlot inSlot, Double posX, Double posY, Double posZ, Single size, Int32 color, Boolean shading, Boolean rotate, Boolean showStacksize) in VintagestoryLib\Client\API\RenderAPIGame.cs:line 274 at Vintagestory.API.Client.SlideshowItemstackTextComponent.RenderInteractiveElements(Single deltaTime, Double renderX, Double renderY, Double renderZ) in VintagestoryApi\Client\UI\Elements\Impl\Interactive\Text\Richtext\SlideshowItemstackTextComponent.cs:line 183 at Vintagestory.API.Client.GuiElementRichtext.RenderInteractiveElements(Single deltaTime) in VintagestoryApi\Client\UI\Elements\Impl\Interactive\Text\GuiElementRichtext.cs:line 484 at Vintagestory.API.Client.GuiComposer.Render(Single deltaTime) in VintagestoryApi\Client\UI\GuiComposer.cs:line 716 at Gourmand.Gui.GuiDialogPatch.OnRenderGUI(GuiDialogCharacter instance, Single deltaTime, Int32& __curTab, Matrixf& mat, Vec4f& lighPos, ElementBounds& insetSlotBounds, Single& yaw, Boolean& rotateCharacter) at Vintagestory.Client.NoObf.GuiDialogCharacter.OnRenderGUI_Patch1(GuiDialogCharacter this, Single deltaTime) at Vintagestory.Client.NoObf.GuiManager.OnRenderFrameGUI(Single deltaTime) in VintagestoryLib\Client\Systems\Gui\GuiManager.cs:line 318 at Vintagestory.Client.NoObf.ClientEventManager.TriggerRenderStage(EnumRenderStage stage, Single dt) in VintagestoryLib\Client\Util\ClientEventManager.cs:line 186 at Vintagestory.Client.NoObf.ClientMain.TriggerRenderStage(EnumRenderStage stage, Single dt) in VintagestoryLib\Client\ClientMain.cs:line 809 at Vintagestory.Client.NoObf.ClientMain.RenderToDefaultFramebuffer(Single dt) in VintagestoryLib\Client\ClientMain.cs:line 1013 at Vintagestory.Client.ScreenManager.Render(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 676 at Vintagestory.Client.ScreenManager.OnNewFrame(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 651 at Vintagestory.Client.NoObf.ClientPlatformWindows.window_RenderFrame(FrameEventArgs e) in VintagestoryLib\Client\ClientPlatform\GameWindow.cs:line 88 at OpenTK.Windowing.Desktop.GameWindow.Run() at Vintagestory.Client.ClientProgram.Start(ClientProgramArgs args, String[] rawArgs) in VintagestoryLib\Client\ClientProgram.cs:line 324 at Vintagestory.Client.ClientProgram.<>c__DisplayClass9_0.<.ctor>b__1() in VintagestoryLib\Client\ClientProgram.cs:line 128 at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93

at Vintagestory.API.Client.GuiComposer.Render(Single deltaTime) in VintagestoryApi\Client\UI\GuiComposer.cs:line 716 at Gourmand.Gui.GuiDialogPatch.OnRenderGUI(GuiDialogCharacter instance, Single deltaTime, Int32& __curTab, Matrixf& mat, Vec4f& lighPos, ElementBounds& insetSlotBounds, Single& yaw, Boolean& rotateCharacter) at Vintagestory.Client.NoObf.GuiDialogCharacter.OnRenderGUI_Patch1(GuiDialogCharacter this, Single deltaTime) at Vintagestory.Client.NoObf.GuiManager.OnRenderFrameGUI(Single deltaTime) in VintagestoryLib\Client\Systems\Gui\GuiManager.cs:line 318 at Vintagestory.Client.NoObf.ClientEventManager.TriggerRenderStage(EnumRenderStage stage, Single dt) in VintagestoryLib\Client\Util\ClientEventManager.cs:line 186 at Vintagestory.Client.NoObf.ClientMain.TriggerRenderStage(EnumRenderStage stage, Single dt) in VintagestoryLib\Client\ClientMain.cs:line 809 at Vintagestory.Client.NoObf.ClientMain.RenderToDefaultFramebuffer(Single dt) in VintagestoryLib\Client\ClientMain.cs:line 1013 at Vintagestory.Client.ScreenManager.Render(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 676 at Vintagestory.Client.ScreenManager.OnNewFrame(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 651 at Vintagestory.Client.NoObf.ClientPlatformWindows.window_RenderFrame(FrameEventArgs e) in VintagestoryLib\Client\ClientPlatform\GameWindow.cs:line 88 at OpenTK.Windowing.Desktop.GameWindow.Run() at Vintagestory.Client.ClientProgram.Start(ClientProgramArgs args, String[] rawArgs) in VintagestoryLib\Client\ClientProgram.cs:line 324 at Vintagestory.Client.ClientProgram.<>c__DisplayClass9_0.<.ctor>b__1() in VintagestoryLib\Client\ClientProgram.cs:line 128 at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93

bluelightning32 commented 1 day ago

Thanks for the detailed report. I see that you used aculinaryartillery@1.2.1 and expandedfoods@1.7.1. I was previously testing with aculinaryartillery@1.1.5 and expandedfoods@1.7.0, because they happened to be what I downloaded a while ago.

Now that I tried with the newest versions like you did, I get the same crash on Linux.

bluelightning32 commented 1 day ago

I reproduced it in the debugger. It's crashing when it tries to show a pie with an ingredient of expandedfoods:soulstormbrew-slop. soulstormbrew-slop has the food category of NoNutrition. The game is trying to look up the pie texture, but there is no entry in the array for NoNutrition, so it throws the array index exception instead. image

Gourmand is trying to make a pie out of everything that has inPiePropertiesByType.partType = "Filling". The EFRecipes mod recently set that on the soulstormbrew-slop. image

I'll workaround this in Gourmand by excluding all pie fillings that have NoNutrition from the achievement, so that the Gourmand tab no longer tries to display them.

Can you test whether such a pie can be created in vanilla and whether it also crashes the game? I'm suspecting that ExpandedFoods introduced a new pie of death.

bluelightning32 commented 1 day ago

Lovely, ExpandedFoods also has a typo in its nutritionPropsWhenInMealByType definition. I spent 30 minutes trying to figure out why I couldn't find the nutritionPropsWhenInMeal attribute on soulstormbrew-slop. The @-(slop|refinedslop) should have been @*-(slop|refinedslop). However, that doesn't affect whether the pie crashes; it just makes it slightly more annoying for me to filter it out.

                nutritionPropsWhenInMealByType: {
                        "@-(slop|refinedslop)": {
                                health: -10,
                                foodcategory: "NoNutrition"
                        },      
                        "*-basic": {    
                                satiety: -100,
                                health: 10,
                                foodcategory: "NoNutrition"
                        },
                },