`java.lang.IndexOutOfBoundsException` from `com.BrassAmber.ba_bt.util.BTLoot.fillPool`
ASchneider-GitHub opened this issue ยท 2 comments
Describe the bug
Server is crashing after tick is taking 60 seconds to complete as shown in the error message from the crash report:
java.lang.Error: ServerHangWatchdog detected that a single server tick took 60.00 seconds (should be max 0.05)
at net.minecraft.server.dedicated.ServerWatchdog.run(ServerWatchdog.java:45) [server-1.18.2-20220404.173914-srg.jar%23332!/:?] {re:classloading}
at java.lang.Thread.run(Thread.java:1589) [?:?] {re:mixin}
When reviewing the debug server logs, it looks like the issue is the function that handles generating loot pools
net.minecraft.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:906) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.dedicated.DedicatedServer.m_5703_(DedicatedServer.java:326) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:842) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:685) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:261) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at java.lang.Thread.run(Thread.java:1589) [?:?]
Caused by: java.lang.IndexOutOfBoundsException: Index 26 out of bounds for length 26
at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:100) ~[?:?]
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106) ~[?:?]
at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302) ~[?:?]
at java.util.Objects.checkIndex(Objects.java:385) ~[?:?]
at java.util.ArrayList.get(ArrayList.java:427) ~[?:?]
at com.BrassAmber.ba_bt.util.BTLoot.fillPool(BTLoot.java:213) ~[BrassAmberBattleTowers-1.18.2-2.3.12.jar%2390!/:1.18.2-2.3.12]
at com.BrassAmber.ba_bt.util.BTLoot.getLootTableBuilder(BTLoot.java:285) ~[BrassAmberBattleTowers-1.18.2-2.3.12.jar%2390!/:1.18.2-2.3.12]
at com.BrassAmber.ba_bt.util.BTLoot.getLootTable(BTLoot.java:261) ~[BrassAmberBattleTowers-1.18.2-2.3.12.jar%2390!/:1.18.2-2.3.12]
at com.BrassAmber.ba_bt.entity.block.BTAbstractObelisk.checkSpawners(BTAbstractObelisk.java:491) ~[BrassAmberBattleTowers-1.18.2-2.3.12.jar%2390!/:1.18.2-2.3.12]
at com.BrassAmber.ba_bt.entity.block.BTAbstractObelisk.m_8119_(BTAbstractObelisk.java:354) ~[BrassAmberBattleTowers-1.18.2-2.3.12.jar%2390!/:1.18.2-2.3.12]
at net.minecraft.server.level.ServerLevel.m_8647_(ServerLevel.java:652) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.world.level.Level.m_46653_(Level.java:5079) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.level.ServerLevel.m_184063_(ServerLevel.java:319) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.world.level.entity.EntityTickList.m_156910_(EntityTickList.java:54) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:299) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:902) ~[server-1.18.2-20220404.173914-srg.jar%23332!/:?]
... 5 more
Function in question: https://github.com/BrassAmber-Mods/Brass_Amber_BattleTowers/blob/1.18.2-Version/src/main/java/com/BrassAmber/ba_bt/util/BTLoot.java#L202
To Reproduce
Things needed to reproduce the behavior: (Replace with your answer)
Unfortunately I'm not sure what exactly is triggering this crash, but my guess is that there's a loot container somewhere causing problems. The crash is happening on a server running an unmodified version of the CRIF2 modpack.
Attached Files
If the issue is related to a specific loot container, I can try removing the chunk from the world file and regenerating it, but unfortunately I'm not sure how to track down the specific chunk that has the problematic chest.
Just realized I fixed this and never answered the Issue here:
This turned out to be because of a Bukkit mixin that overwrote a function we were using to build the loot item lists and put them in the chests.
Was fixed in commit 0058d44
I think you may have seen this in the update notes when it happened, but updating this Issue anyways.