Jump to content

OOB Exception when adding entity to world.


AkitaAttribute

Recommended Posts

[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.

 

Spoiler
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

 

 

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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).

  • Like 1

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Compare this list (client-side-only mods) with your mods: https://www.dropbox.com/scl/fi/yeldxfv8ed60e4uflc2fi/Client-Side-Only-Modlist.xlsx?rlkey=8376c5bk7b33je2tad4p3ybrg&st=qf6osvit&dl=0  
    • Crashlog: https://paste.ee/p/WrGYD I'm thinking the problem might be a client side mod but ive already checked the mod list like 5 times and still cant find the problem
    • I'm unable to join my local forge servers. When running my forge servers of seemingly any version (tested 1.18 to 1.21.1) I get an error message [Forge Version Check/WARN] [ne.mi.fm.VersionChecker/]: Failed to process update information The server continues to start up and run, however I'm unable to join. Looking for solutions? Full error message: (note last "thead warning" error seems to be unrelated and only happened once for 1.20.1) Forge version check warning has happened for every version. [09:52:31] [Forge Version Check/WARN] [ne.mi.fm.VersionChecker/]: Failed to process update information java.net.http.HttpConnectTimeoutException: HTTP connect timed out         at jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:950) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133) ~[java.net.http:?] {}         at net.minecraftforge.fml.VersionChecker$1.openUrlString(VersionChecker.java:142) ~[fmlcore-1.20.1-47.3.10.jar%23102!/:?] {}         at net.minecraftforge.fml.VersionChecker$1.process(VersionChecker.java:180) ~[fmlcore-1.20.1-47.3.10.jar%23102!/:?] {}         at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}         at net.minecraftforge.fml.VersionChecker$1.run(VersionChecker.java:117) ~[fmlcore-1.20.1-47.3.10.jar%23102!/:?] {} Caused by: java.net.http.HttpConnectTimeoutException: HTTP connect timed out         at jdk.internal.net.http.ResponseTimerEvent.handle(ResponseTimerEvent.java:68) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(HttpClientImpl.java:1788) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1385) ~[java.net.http:?] {} Caused by: java.net.ConnectException: HTTP connect timed out         at jdk.internal.net.http.ResponseTimerEvent.handle(ResponseTimerEvent.java:69) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl.purgeTimeoutsAndReturnNextDeadline(HttpClientImpl.java:1788) ~[java.net.http:?] {}         at jdk.internal.net.http.HttpClientImpl$SelectorManager.run(HttpClientImpl.java:1385) ~[java.net.http:?] {} [09:52:31] [Yggdrasil Key Fetcher/ERROR] [mojang/YggdrasilServicesKeyInfo]: Failed to request yggdrasil public key com.mojang.authlib.exceptions.AuthenticationUnavailableException: Cannot contact authentication server         at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:119) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:91) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo.fetch(YggdrasilServicesKeyInfo.java:94) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilServicesKeyInfo.lambda$get$1(YggdrasilServicesKeyInfo.java:81) ~[authlib-4.0.43.jar%2375!/:?] {}         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?] {}         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?] {}         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?] {}         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?] {}         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?] {}         at java.lang.Thread.run(Thread.java:1575) ~[?:?] {} Caused by: java.net.SocketTimeoutException: Connect timed out         at sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546) ~[?:?] {}         at sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592) ~[?:?] {}         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[?:?] {}         at java.net.Socket.connect(Socket.java:760) ~[?:?] {}         at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:304) ~[?:?] {}         at sun.net.NetworkClient.doConnect(NetworkClient.java:178) ~[?:?] {}         at sun.net.www.http.HttpClient.openServer(HttpClient.java:531) ~[?:?] {}         at sun.net.www.http.HttpClient.openServer(HttpClient.java:636) ~[?:?] {}         at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264) ~[?:?] {}         at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:377) ~[?:?] {}         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:193) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1273) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1114) ~[?:?] {}         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:179) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1676) ~[?:?] {}         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1600) ~[?:?] {}         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223) ~[?:?] {}         at com.mojang.authlib.HttpAuthenticationService.performGetRequest(HttpAuthenticationService.java:140) ~[authlib-4.0.43.jar%2375!/:?] {}         at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:96) ~[authlib-4.0.43.jar%2375!/:?] {}         ... 9 more [09:52:31] [Server thread/WARN] [minecraft/MinecraftServer]: Can't keep up! Is the server overloaded? Running 5985ms or 119 ticks behind
    • Remove the mod tempad from the mods-folder
    • Hi, deleting the config folder did not appear to work, what mod are you referring to I could try to delete to fix the problem?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.