BeansGalaxy / Beans-Backpacks-2

1.20 inventory management mod. Designed to solve inventory clutter and transferring items while belonging in vanilla Minecraft's aesthetic.
MIT License
21 stars 1 forks source link

Crashing when moving items from and in to the backpack (1.20.1) #142

Closed iva-exe closed 1 month ago

iva-exe commented 2 months ago

net.minecraft.class_148: Rendering screen at net.minecraft.class_757.method_3192(class_757.java:954) ~[client-intermediary.jar:?] at net.minecraft.class_310.method_1523(class_310.java:1219) ~[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) ~[1.20.1-0.15.10.jar:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) ~[fabric-loader-0.15.10.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.15.10.jar:?] at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.15.10.jar:?] Caused by: java.util.NoSuchElementException: java.lang.IndexOutOfBoundsException: Index 6 out of bounds for length 5 at java.util.AbstractList$Itr.next(AbstractList.java:377) ~[?:?] at com.beansgalaxy.backpacks.inventory.BackpackInventory.spaceLeft(BackpackInventory.java:250) ~[BeansBackpacks-fabric-1.20.1-0.27-v2.jar:?] at com.beansgalaxy.backpacks.screen.BackpackMenu.updateSlots(BackpackMenu.java:122) ~[BeansBackpacks-fabric-1.20.1-0.27-v2.jar:?] at com.beansgalaxy.backpacks.screen.BackpackScreen.method_25394(BackpackScreen.java:110) ~[BeansBackpacks-fabric-1.20.1-0.27-v2.jar:?] at net.minecraft.class_437.method_47413(class_437.java:110) ~[client-intermediary.jar:?] at net.minecraft.class_757.method_3192(class_757.java:945) ~[client-intermediary.jar:?] ... 6 more Caused by: java.lang.IndexOutOfBoundsException: Index 6 out of bounds for length 5 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.minecraft.class_2371.get(class_2371.java:47) ~[client-intermediary.jar:?] at java.util.AbstractList$Itr.next(AbstractList.java:371) ~[?:?] at com.beansgalaxy.backpacks.inventory.BackpackInventory.spaceLeft(BackpackInventory.java:250) ~[BeansBackpacks-fabric-1.20.1-0.27-v2.jar:?] at com.beansgalaxy.backpacks.screen.BackpackMenu.updateSlots(BackpackMenu.java:122) ~[BeansBackpacks-fabric-1.20.1-0.27-v2.jar:?] at com.beansgalaxy.backpacks.screen.BackpackScreen.method_25394(BackpackScreen.java:110) ~[BeansBackpacks-fabric-1.20.1-0.27-v2.jar:?] at net.minecraft.class_437.method_47413(class_437.java:110) ~[client-intermediary.jar:?] at net.minecraft.class_757.method_3192(class_757.java:945) ~[client-intermediary.jar:?] ... 6 more

iva-exe commented 1 month ago

So i tested it. Its not a compatibility issue. Mod just crashes even without any other mods. Its also not linked to getting items in or out of the backpack. Usually it happens after some time looking into the the inventory of the backpack and hovering over inventory slots. (with same error as before)

BeansGalaxy commented 1 month ago

I can't seen to replicate this no matter what I try. There's a suspect line of code right where that crash points to and I changed it but if you have a vid of crashing the game that might help in replicating it.

I think this might be the same issue as #140 but both of you can easily replicate it and I'm having no issue on my system. I can't confirm anything's fixed until I roll out the next update then hear back and crossing your fingers typically isn't the best way to bug fix

iva-exe commented 1 month ago

Video: https://youtu.be/74cYeoMBYmU

BeansGalaxy commented 1 month ago

Solution

The issue happens when the menu's slots try to reorganize themself. I've already updated where the crash report points to which I'm pretty confident is causing the crash. I currently reorganize the slots every frame which I'll change to checking every time a player clicks so that code is called less frequently. Keep a lookout for version 20.1-0.28-v2

Thank you

The video goes a long way and I really appreciate the editing and captions too. I see in your mod pack the lighting for the backpack is all messed up. You should consider using the mods Oculus & Embeddium instead of Optifine. Optifine need a re-write and isn't too friendly for compatibility and Sodium/Iris & Embeddium/Oculus is still great for performance.

iva-exe commented 1 month ago

Thanks lot for solving this ^^ I noticed it too. Iam using iris with sodium and not optifine tho :d

BeansGalaxy commented 1 month ago

Oops what shader are you using?

iva-exe commented 1 month ago

Latest BSL shaders

BeansGalaxy commented 1 month ago

0.28-v2 is out with the patches. I also cleaned up how the backpack is lit in the menu but haven't tested it out with BSL in sodium just yet:)

iva-exe commented 1 month ago

Thanks a lot.. Works nicely. Lighting is pretty similar as before with shaders but its not really glitchy so its ok ^^