[1.14.4] ArrayIndexOutOfBoundsException
Rumpelstiltskinny opened this issue ยท 3 comments
When r-clicking an empty 2-slot toolbelt from the hotbar it crashes the server.
Minecraft: 1.14.4
Forge: 28.1.40
Fabric: F* fabric
ToolBelt: 1.12.3
crash:
Description: Ticking entity
java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.Arrays$ArrayList.get(Unknown Source) ~[?:1.8.0_201] {}
at net.minecraft.util.NonNullList.get(SourceFile:46) ~[?:?] {re:classloading}
at net.minecraft.entity.player.PlayerInventory.func_70301_a(PlayerInventory.java:517) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at gigaherz.toolbelt.common.BeltSlot$1.findStack(BeltSlot.java:27) ~[?:1.12.3] {re:classloading}
at gigaherz.toolbelt.common.BeltSlot$1.func_70301_a(BeltSlot.java:54) ~[?:1.12.3] {re:classloading}
at net.minecraft.inventory.container.Slot.func_75211_c(Slot.java:54) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.inventory.container.Container.func_75142_b(Container.java:116) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at gigaherz.toolbelt.common.BeltContainer.func_75142_b(BeltContainer.java:83) ~[?:1.12.3] {re:classloading}
at net.minecraft.entity.player.ServerPlayerEntity.func_70071_h_(ServerPlayerEntity.java:321) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.world.server.ServerWorld.func_217479_a(ServerWorld.java:587) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.world.World.func_217390_a(World.java:684) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at net.minecraft.world.server.ServerWorld.func_72835_b(ServerWorld.java:394) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:829) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:324) ~[?:?] {re:classloading,pl:accesstransformer:B}
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:764) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:622) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
at java.lang.Thread.run(Unknown Source) [?:1.8.0_201] {}
A detailed walkthrough of the error, its code path and all known details is as follows:
-- Head --
Thread: Server thread
Stacktrace:
at java.util.Arrays$ArrayList.get(Unknown Source)
at net.minecraft.util.NonNullList.get(SourceFile:46)
at net.minecraft.entity.player.PlayerInventory.func_70301_a(PlayerInventory.java:517)
at gigaherz.toolbelt.common.BeltSlot$1.findStack(BeltSlot.java:27)
at gigaherz.toolbelt.common.BeltSlot$1.func_70301_a(BeltSlot.java:54)
at net.minecraft.inventory.container.Slot.func_75211_c(Slot.java:54)
at net.minecraft.inventory.container.Container.func_75142_b(Container.java:116)
at gigaherz.toolbelt.common.BeltContainer.func_75142_b(BeltContainer.java:83)
at net.minecraft.entity.player.ServerPlayerEntity.func_70071_h_(ServerPlayerEntity.java:321)
at net.minecraft.world.server.ServerWorld.func_217479_a(ServerWorld.java:587)
-- Entity being ticked --
Details:
Entity Type: minecraft:player (net.minecraft.entity.player.ServerPlayerEntity)
Ah, yeah. Forgot to mention that I had two empty belts in my inventory, nice catch. Thanks for the prompt reply.
Managed to reproduce. I'm not sure what would trigger it, but I think it happens if you have more than one belt in the inventory. Regardless, I have improved the logic involved in detecting which item is currently being used to be more strict about how it detects the belt. This does mean there's some theoretical circumstances in which the right-click inventory could refuse to work, but I can't ensure consistency otherwise.
Bugfix release soon.
Hopefully fixed for good. https://www.curseforge.com/minecraft/mc-mods/tool-belt/files/2815691