Tfarcenim / DankStorageFabric

Creative Commons Zero v1.0 Universal
11 stars 9 forks source link

Slot locking can sometimes fail/crash #16

Closed Fourmisain closed 3 years ago

Fourmisain commented 3 years ago

Not 100% sure on how to reproduce the crash, but I got a log and was able to reproduce the underlying ArrayIndexOutOfBoundsException:

[Server thread/ERROR] [MinecraftServer]: Encountered an unexpected exception net.minecraft.class_148: Ticking block entity at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:875) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:811) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_1132.method_3748(class_1132.java:91) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:670) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257) ~[intermediary-minecraft-1.16.5-client.jar:?] at java.lang.Thread.run(Thread.java:831) [?:?] Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 38 out of bounds for length 0 at tfar.dankstorage.inventory.DankInventory.isLocked(DankInventory.java:95) ~[dankstorage-1.10a-1.16.5.jar:?] at tfar.dankstorage.inventory.DankInventory.method_5434(DankInventory.java:55) ~[dankstorage-1.10a-1.16.5.jar:?] at tfar.dankstorage.blockentity.DockBlockEntity.method_5434(DockBlockEntity.java:163) ~[dankstorage-1.10a-1.16.5.jar:?] at net.minecraft.class_2614.method_11261(class_2614.java:223) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_2614.method_17768(class_2614.java:206) ~[intermediary-minecraft-1.16.5-client.jar:?] at java.util.stream.MatchOps$2MatchSink.accept(MatchOps.java:119) ~[?:?] at java.util.stream.Streams$RangeIntSpliterator.tryAdvance(Streams.java:82) ~[?:?] at java.util.stream.IntPipeline.forEachWithCancel(IntPipeline.java:163) ~[?:?] at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502) ~[?:?] at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488) ~[?:?] at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?] at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:230) ~[?:?] at java.util.stream.MatchOps$MatchOp.evaluateSequential(MatchOps.java:196) ~[?:?] at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?] at java.util.stream.IntPipeline.anyMatch(IntPipeline.java:537) ~[?:?] at net.minecraft.class_2614.method_11241(class_2614.java:206) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_2614.method_11249(class_2614.java:109) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_2614.method_11243(class_2614.java:125) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_2614.method_16896(class_2614.java:109) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_1937.method_18471(class_1937.java:510) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.class_3218.method_18765(class_3218.java:429) ~[intermediary-minecraft-1.16.5-client.jar:?] at net.minecraft.server.MinecraftServer.method_3813(MinecraftServer.java:871) ~[intermediary-minecraft-1.16.5-client.jar:?]

To reproduce, put a fresh dank in a dock and try to lock any slot.

This happens even when an item is put into the slot right before trying to lock it and when retrieving the dank from the dock and putting it back in.

Opening the dank in your hand once seems to fix the issue.

edit: The crash happens when there's a hopper below a dock and you put in a fresh dank, open it and put an item in it.

Tfarcenim commented 3 years ago

fixed in 2.0