Siphalor / mouse-wheelie

"Small" Minecraft mod focusing on inventory utilities, like scrolling, sorting and auto refilling of items
https://modrinth.com/mod/mouse-wheelie
Apache License 2.0
113 stars 41 forks source link

[bug] Crash when space-clicking items to/from a chest (space+click) #246

Open mapokapo opened 1 year ago

mapokapo commented 1 year ago

Version MC: 1.20.1 Mouse Wheelie: 1.12.2+mc1.20.1

Describe the bug When you try to use the "deposit" modifier (default is space+click) on a bunch of items, the game crashes.

To Reproduce

  1. Enter world
  2. Open chest
  3. Hold space and click an item inside the chest/your inventory
  4. The game crashes

Expected behavior The items should move without crashing.

Log The game crashes with the following stack traces (irrelevant parts omitted):

net.minecraft.class_148: mouseClicked event handler
    at net.minecraft.class_437.method_25412(class_437.java:414) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_1601(class_312.java:98) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_22686(class_312.java:169) ~[client-intermediary.jar:?]
    at net.minecraft.class_1255.execute(class_1255.java:102) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_22684(class_312.java:169) ~[client-intermediary.jar:?]
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43) ~[lwjgl-glfw-3.3.1.jar:?]
    at org.lwjgl.system.JNI.invokeV(Native Method) ~[lwjgl-3.3.1.jar:?]
    at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3403) ~[lwjgl-glfw-3.3.1.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:201) ~[client-intermediary.jar:?]
    at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:219) ~[client-intermediary.jar:?]
    at net.minecraft.class_1041.method_15998(class_1041.java:288) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1523(class_310.java:1241) ~[client-intermediary.jar:?]
    at net.minecraft.class_310.method_1514(class_310.java:802) ~[client-intermediary.jar:?]
    at net.minecraft.client.main.Main.main(Main.java:250) ~[minecraft-1.20.1-client.jar:?]
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.22.jar:?]
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.22.jar:?]
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.22.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 org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) ~[NewLaunch.jar:?]
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) ~[NewLaunch.jar:?]
    at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
    at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]
Caused by: java.util.NoSuchElementException: Iterated past beginning of backing list
    at de.siphalor.mousewheelie.client.util.ReverseIterator.next(ReverseIterator.java:46) ~[mousewheelie-1.12.2+mc1.20.1.jar:?]
    at de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper.restockAllOfAKind(ContainerScreenHelper.java:382) ~[mousewheelie-1.12.2+mc1.20.1.jar:?]
    at de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper.restockAllOfAKind(ContainerScreenHelper.java:357) ~[mousewheelie-1.12.2+mc1.20.1.jar:?]
    at net.minecraft.class_465.handler$com000$mousewheelie$onMouseClick(class_465.java:3388) ~[client-intermediary.jar:?]
    at net.minecraft.class_465.method_25402(class_465.java) ~[client-intermediary.jar:?]
    at net.minecraft.class_312.method_1611(class_312.java:98) ~[client-intermediary.jar:?]
    at net.minecraft.class_437.method_25412(class_437.java:409) ~[client-intermediary.jar:?]
    ... 24 more
java.util.NoSuchElementException: Iterated past beginning of backing list
    at de.siphalor.mousewheelie.client.util.ReverseIterator.next(ReverseIterator.java:46)
    at de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper.restockAllOfAKind(ContainerScreenHelper.java:382)
    at de.siphalor.mousewheelie.client.inventory.ContainerScreenHelper.restockAllOfAKind(ContainerScreenHelper.java:357)
    at net.minecraft.class_465.handler$com000$mousewheelie$onMouseClick(class_465.java:3388)
    at net.minecraft.class_465.method_25402(class_465.java)
    at net.minecraft.class_312.method_1611(class_312.java:98)
    at net.minecraft.class_437.method_25412(class_437.java:409)
    at net.minecraft.class_312.method_1601(class_312.java:98)
    at net.minecraft.class_312.method_22686(class_312.java:169)
    at net.minecraft.class_1255.execute(class_1255.java:102)
    at net.minecraft.class_312.method_22684(class_312.java:169)
    at org.lwjgl.glfw.GLFWMouseButtonCallbackI.callback(GLFWMouseButtonCallbackI.java:43)
    at org.lwjgl.system.JNI.invokeV(Native Method)
    at org.lwjgl.glfw.GLFW.glfwWaitEventsTimeout(GLFW.java:3474)
    at com.mojang.blaze3d.systems.RenderSystem.limitDisplayFPS(RenderSystem.java:237)
    at net.minecraft.class_310.method_1523(class_310.java:1244)
    at net.minecraft.class_310.method_1514(class_310.java:802)
    at net.minecraft.client.main.Main.main(Main.java:250)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    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 org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243)
    at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278)
    at org.multimc.EntryPoint.listen(EntryPoint.java:143)
    at org.multimc.EntryPoint.main(EntryPoint.java:34)

Additional context I am using MultiMC and the latest Fabric/Fabric API version.

The crash still happens even if Mouse Wheelie is the only mod installed.