AkitaAttribute Posted November 17, 2021 Posted November 17, 2021 [Exception ticking world] - [Caused by: java.lang.ArrayIndexOutOfBoundsException: -1] Really hoping someone has seen this before. I'm probably doing something dumb (doing a lot dumb) that I just don't know is wrong when it comes to "world" stuff. My code: Main SRC Dir Subscribe Event where I'm replacing entities with custom ones: Line 247 Where I'm actually adding the entity to the world: Line 52 I know this is working because I've seen it in my world. After one working instance, the world hangs, and eventually crashes with the below log dump. Please don't harp on poor coding style (the threading for the world I would like to know if that's the issue), as this is a work in progress. Reveal hidden contents 14:23:32.420 game [14:23:32] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Tried to add glowing. [GlowingEntities][6] 14:23:32.420 game [14:23:32] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Attempted to add glowing. [Item][ItemEntity['Raw Beef'/1509, l='ServerLevel[maybe]', x=-81.28, y=75.00, z=-155.20]][Glowing][true] 14:23:32.420 game [14:23:32] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Key not found, manually swapping... [1 leather]->[1 leather] 14:23:32.421 game [14:23:32] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Key not found, manually swapping... [3 beef]->[3 beef] 14:23:43.012 game [14:23:43] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Attempted to remove glowing. [Item][3 beef][Glowing][false] 14:23:54.860 game [14:23:54] [Server thread/INFO] [ma.rp.RpgElements/]: [BTK7] picked up [minecraft:beef] 14:24:24.559 game [14:24:24] [Server thread/INFO] [ma.rp.RpgElements/]: [BTK7] picked up [minecraft:dirt] 14:24:26.988 game [14:24:26] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Tried to add glowing. [GlowingEntities][6] 14:24:27.688 game [14:24:27] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Tried to add glowing. [GlowingEntities][6] 14:24:27.690 game [14:24:27] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Tried to add glowing. [GlowingEntities][7] 14:24:27.691 game [14:24:27] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Attempted to add glowing. [Item][ItemEntity['Raw Beef'/1706, l='ServerLevel[maybe]', x=-85.62, y=72.23, z=-157.60]][Glowing][true] 14:24:27.692 game [14:24:27] [Server thread/INFO] [minecraft/NewChatGui]: [CHAT] Key not found, manually swapping... [3 beef]->[3 beef] 14:24:30.512 game [14:24:30] [Server thread/FATAL] [ne.mi.co.ForgeMod/]: Preparing crash report with UUID 05e7ebbe-83fa-43e2-9ff5-562bfb690496 14:24:30.515 game [14:24:30] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception 14:24:30.515 game net.minecraft.crash.ReportedException: Exception ticking world 14:24:30.516 game at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:855) ~[?:?] {re:classloading,pl:accesstransformer:B} 14:24:30.516 game at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:787) ~[?:?] {re:classloading,pl:accesstransformer:B} 14:24:30.516 game at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:78) ~[?:?] {re:classloading,pl:runtimedistcleaner:A} 14:24:30.516 game at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) [?:?] {re:classloading,pl:accesstransformer:B} 14:24:30.516 game at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) [?:?] {re:classloading,pl:accesstransformer:B} 14:24:30.516 game at net.minecraft.server.MinecraftServer$$Lambda$5101/1446321154.run(Unknown Source) [?:?] {} 14:24:30.516 game at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51] {} 14:24:30.516 game Caused by: java.lang.ArrayIndexOutOfBoundsException: -1 14:24:30.516 game at it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap.fixPointers(Int2ObjectLinkedOpenHashMap.java:1038) ~[fastutil-8.2.1.jar:?] {re:classloading} 14:24:30.516 game at it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap$MapIterator.remove(Int2ObjectLinkedOpenHashMap.java:1269) ~[fastutil-8.2.1.jar:?] {} 14:24:30.516 game at it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap$EntryIterator.remove(Int2ObjectLinkedOpenHashMap.java:1309) ~[fastutil-8.2.1.jar:?] {re:classloading} 14:24:30.516 game at net.minecraft.world.server.ServerWorld.func_72835_b(ServerWorld.java:411) ~[?:?] {re:classloading} 14:24:30.516 game at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:851) ~[?:?] {re:classloading,pl:accesstransformer:B} 14:24:30.516 game ... 6 more 14:24:31.315 game AL lib: (EE) alc_cleanup: 1 device not closed 14:24:32.078 monitor Process Monitor Process crashed with exit code -1 Quote
Luis_ST Posted November 17, 2021 Posted November 17, 2021 post full log (via https://gist.github.com/), and please stop formatting them since its hard to read Quote
AkitaAttribute Posted November 17, 2021 Author Posted November 17, 2021 @Luis_ST Here ya go: https://gist.github.com/AkitaAttribute/b593ebb9c91ad70a7aa3be6a1d048543 Quote
Draco18s Posted November 17, 2021 Posted November 17, 2021 https://github.com/AkitaAttribute/rpg-elements/blob/working_but_crashing/src/main/java/magicsixteen/rpgelements/RpgElements.java#L252 item.isEmpty() https://github.com/AkitaAttribute/rpg-elements/blob/working_but_crashing/src/main/java/magicsixteen/rpgelements/events/item/GlowingItemEntity.java#L15 Why are you storing an item entity inside your custom item entity? Just use the details of that entity to create yours using an existing constructor. You're trying to replace the entity, not wrap it. https://github.com/AkitaAttribute/rpg-elements/blob/working_but_crashing/src/main/java/magicsixteen/rpgelements/RpgElements.java#L255 Not sure this check is needed. https://github.com/AkitaAttribute/rpg-elements/blob/working_but_crashing/src/main/java/magicsixteen/rpgelements/events/item/GlowingItemEntity.java#L62-L108 This is a disgusting hack. One that I'm not even sure works. https://github.com/AkitaAttribute/rpg-elements/blob/working_but_crashing/src/main/java/magicsixteen/rpgelements/util/GlowHelper.java#L61 This check almost certainly won't pass. Existing item entities will never appear in the glowing list. Actually wait a minute. This entire class is useless. Jesus fucking christ. Just use the GlowingItemEntity to store a number of ticks and then in its on-tick, subtract one, and if it's less than 0, set glowing to false. You don't need a globally accessible list of all glowing item entities and when they should stop glowing. Nothing cares except the entity itself, so just store that data in the entity. Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
AkitaAttribute Posted November 18, 2021 Author Posted November 18, 2021 https://gist.github.com/AkitaAttribute/52e1a06ee0c54256f50d615884aadf6f New issues. So @Draco18s, LivingDropsEvent happens first. Which means that I can't run a check on the source of the dropped item to determine duration of the glow, and add that duration to the custom entity. The updated branch takes most of your comments into consideration. I tried to do a tracker for the brief moment I assume exists between LivingDrops and JoinedWorld events to pass the duration between them. This doesn't work, and I'm getting a crash that I thought I had resolved by putting the world.addEntity onto another thread. I'd love to hear input on what you think is the best solution for dealing with the duration between these two events. And more importantly, why I'm getting the ConcurrentModificationException Quote
AkitaAttribute Posted November 18, 2021 Author Posted November 18, 2021 I suppose you could tell me to do the GlowingItemEntity in the LivingDropsEvent, but I don't want to cancel that because it's doing other things that I don't want to modify. That sounds like a pain in the ass. Quote
Draco18s Posted November 18, 2021 Posted November 18, 2021 I think you can modify the drops array during the LivingDropsEvent, though (well, collection, but it's not read-only so I don't see why you couldn't remove the originals and add yours). 1 Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
AkitaAttribute Posted November 18, 2021 Author Posted November 18, 2021 That worked. Had to modify the whole collection at once. Save it temporarily, then remove the original, modify, then add the modified all at once. I was getting the concurrent exception otherwise, and multi-drop mobs wouldn't drop anything. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.