Mods / RayTraceForSelectionCrashFix

Tags:
QoL
Author:
SiiMeR
Side:
Both
Created:
Sep 27th 2025 at 6:21 PM
Last modified:
Sep 27th 2025 at 6:21 PM
Downloads:
1381
Latest release (for Vintage Story 1.20.12, outdated):
raytraceforselectioncrashfix_1.0.0.zip  1-click install

Fixes the following exception/crash that happens while chiseling

 

System.IndexOutOfRangeException: Index was outside the bounds of the array. at Vintagestory.Common.GameMain.RayTraceForSelection(IWorldIntersectionSupplier supplier, Ray ray, BlockSelection& blockSelection, EntitySelection& entitySelection, BlockFilter bfilter, EntityFilter efilter) at Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.UpdateCurrentSelection() in VintagestoryLib\Client\Systems\Player\MouseInWorldInteractions.cs:line 378 at Vintagestory.Client.NoObf.SystemMouseInWorldInteractions.OnFinalizeFrame(Single dt) in VintagestoryLib\Client\Systems\Player\MouseInWorldInteractions.cs:line 85 at Vintagestory.Client.NoObf.ClientEventManager.TriggerRenderStage(EnumRenderStage stage, Single dt) in VintagestoryLib\Client\Util\ClientEventManager.cs:line 188 at Vintagestory.Client.NoObf.ClientMain.RenderToDefaultFramebuffer(Single dt) in VintagestoryLib\Client\ClientMain.cs:line 996 at Vintagestory.Client.GuiScreenRunningGame.RenderToDefaultFramebuffer(Single dt) in VintagestoryLib\Client\MainMenu\Screens\GuiScreenRunningGame.cs:line 242 at Vintagestory.Client.ScreenManager.Render(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 695 at Vintagestory.Client.ScreenManager.OnNewFrame(Single dt) in VintagestoryLib\Client\ScreenManager.cs:line 670 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 334 at Vintagestory.Client.ClientProgram.<>c__DisplayClass10_0.<.ctor>b__1() in VintagestoryLib\Client\ClientProgram.cs:line 130 at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.0.0 raytraceforselectioncrashfix 1381 Sep 27th 2025 at 6:21 PM raytraceforselectioncrashfix_1.0.0.zip 1-click install

* First release


5 Comments (oldest first | newest first) (threaded | flat)

Roman1776, Nov 2nd 2025 at 8:26 PM

SiiMeR Well, thank you nonetheless for sharing this mod with the community!

SiiMeR , Nov 2nd 2025 at 6:48 PM

I think I used a harmony finalizer which allows you to ignore exceptions and return some default value Roman1776

Roman1776, Nov 2nd 2025 at 6:22 PM

SiiMeR It did indeed fix our issue, not sure how or why, but this is working on our 1.21.4 world. We have not crashed once since this mod was added, even with all our chiseling projects and a hefty 60 mods in our server. So thanks for making this mod, it saved our world!

I am curious how this mod works. Did you simply make an exception when this error occurs to recalculate the array instead of just crashing? Sometimes we still experience hard lag spikes while working on large chisel projects, but they always recover, this is wayyyy better than crashing haha.

SiiMeR , Oct 28th 2025 at 9:05 PM

Do try it out and let me know.

Roman1776, Oct 28th 2025 at 8:37 PM (modified Oct 28th 2025 at 8:50 PM)

Is it not needed post 1.20.12? I'm having this thrown in my buddy's face every few minutes while he is chiseling on our MP world in 1.21.4... I'm gonna try this and fingers crossed it works, I'll let everyone know if it does, as we've been dying trying to fix this.