MineKhan
MineKhan copied to clipboard
Lighting Crash
So I was playing minekhan on willard.fun.
Then everything went blank.
Here is a screenshot:
Was someone else in the world? I wrapped it in a try-catch to stop it from freezing from that multiplayer lighting bug, but that happens instead, so it's not a great fix lol.
I wasn't in multiplayer.
Oh. Were you building at the edge of ungenerated chunks or something then? 🤔
I was playing around with slabs and it was nowhere near ungenerated chunks.
There were also some dropped items but they were really far away.
It's prob willard. as herobrine
I just joined a multiplayer world and everything was blank. It looks like the same thing as the screenshot above.
I think I found out how to reproduce this bug but its not quite right. EDIT: I think this is actually another bug.
- So make a 3x3 square above the ground.
- Put a upside-down slab on one edge (not the corner)
- Throw an item in the middle of the square.
- If the item falls through the square, you did it right
- Wait
- Everything goes weird. So if you throw more items, There will be weird things going on.
Screenshot:
Actually if you throw an item at a bunch of upside-down slabs above the ground, it will also happen
There are a lot of errors in the console.
I think you need to change the getlight function. Just make it so if the y is less than 1, return 0.
Can you send a small world save with reproduction steps? This bug has been around for awhile, but I've only experienced it myself in multiplayer, and only very sporadically, so I haven't been able to debug it to fix it.
I don't know how to reproduce the first bug. For the second bug, You just have to throw an item on an upside-down slab.
I think this fixes the bug:
getLight(x, y, z, blockLight = 0) {
if(y < 1) return 0 //<= that
let X = (x >> 4) + this.offsetX
let Z = (z >> 4) + this.offsetZ
if (X < 0 || X >= this.lwidth || Z < 0 || Z >= this.lwidth) {
return this.chunks[x >> 4][z >> 4].getLight(x & 15, y, z & 15, blockLight)
}
return this.loaded[X * this.lwidth + Z].getLight(x & 15, y, z & 15, blockLight)
}
Putting this in the console can also fix it:
world.__proto__.getLight = function(t,e,r,n=0){
if(e<1) return 0;
var o=(t>>4)+this.offsetX,i=(r>>4)+this.offsetZ;return(o<0||o>=this.lwidth||i<0||i>=this.lwidth?this.chunks[t>>4][r>>4]:this.loaded[o*this.lwidth+i]).getLight(15&t,e,15&r,n)}
Ummm, what?
Reading over this again, it appears the crash was caused by dropped items outside rendered chunks. As dropped items are gone, this shouldn't be an issue any more. Hopefully.