[1.16.5 / Fabric] Failed to inject light data into save data for chunk
Dragon-Seeker opened this issue ยท 4 comments
Ive got no clue if its a mod incompatibility but Without starlight, Ive got no issue.
Huge lag spikes when loading new chunks
Initially the world will load with this Error Message:
[16:17:55] [Server thread/WARN]: Failed to inject light data into save data for chunk [-4, -14], chunk light will be recalculated on its next load
java.lang.ArrayIndexOutOfBoundsException: Index 256 out of bounds for length 18
at net.minecraft.class_2852.saveLightHookReal(class_2852.java:1110) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_2852.handler$bkc000$saveLightHook(class_2852.java:1069) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_2852.method_12410(class_2852.java:360) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_3898.method_17228(class_3898.java:716) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_3898.method_20583(class_3898.java:388) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) ~[?:?]
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177) ~[?:?]
at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?]
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) ~[?:?]
at net.minecraft.class_3898.method_17242(class_3898.java:385) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_3215.method_17298(class_3215.java:321) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_3218.method_14176(class_3218.java:710) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.server.MinecraftServer.method_3723(MinecraftServer.java:567) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.class_1132.method_3748(class_1132.java:83) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:670) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:257) ~[intermediary-fabric-loader-0.11.3-1.16.5.jar:?]
at java.lang.Thread.run(Thread.java:832) [?:?]
but after reloading it now spits this out:
[16:19:51] [Server thread/WARN]: Failed to inject light data into save data for chunk [-9, -2], chunk light will be recalculated on its next load
java.lang.ArrayIndexOutOfBoundsException: null
ModList: https://pastebin.com/tW8YiHAd
A while back I did some debugging on this problem with a user who volunteered to provide data I could test. First, they provided chunk data I could use to actually run through starlight's logic on my own. Didn't produce.
Secondly, the chunk data they provided indicated a mod had clearly rewritten the section data - the section Y was an int, but starlight/vanilla actually use a byte to store the y value. This mod didn't use a mixin to inject this either; I had inspected the mixin debug output with a decompiler. So I really don't know what happened there, and I probably never will.
The relevant code that produces this exception is here:
int k = sectionStored.getByte("Y");
...
if (!sectionStored.isEmpty()) {
sections[k - minSection] = sectionStored; // here is the out of bounds access
}
where minSection
is -1 since this occurs on 1.16.5. k can ONLY be in range [-128, 127] because it's a byte.
k
must have been 255 to get an index of 256, as 255 - (-1) = 256. But since k is a byte, 255 is not allowed.
I had inspected the user's chunk data further to discover that the code failed on the first section stored, which was the section with y = -1
, or in this case, k = -1
.
That doesn't make remotely any sense at all. There is some other mod that came into play to cause k
to become 255, when it should have been -1. And it really didn't leave any traces behind. So I'm not looking into this further.
I've made a special debug jar here that will output the chunk data if the save fails, can you try again and give the logs? (Log files might get big since it will dump a lot of chunk data)
starlight-fabric-1.0.0-RC2-bb584af.zip
Ok so Paste bin didn't work and github sasys the file is way to big. Here's a google drive link to the log file: https://drive.google.com/file/d/1DtZiRpKT48RwkBaNI9ihiWpHJ4BElZun/view?usp=sharing