Closed Qveshn closed 4 years ago
Solution: check if NibbleArray is not nul at his position
...
if (leb.a(SectionPosition.a(position)) != null) {
leb.a(position, finalLightLevel);
}
...
In addition: I have released 1.14 update for LightAPI in my fork. There you can see how I solved this and other problems (NibbleArray, client view distance, locking ThreadedMailbox). Here is nms engine for 1.14: https://github.com/Qveshn/LightAPI/blob/3.0/nms/v1_14_R1/src/main/java/ru/beykerykt/lightapi/server/nms/craftbukkit/CraftBukkit_v1_14_R1.java
Exception occurs when creating light in chunk section (16x16x16) which is completely empty and all surrounded 26 ones are also completely empty.
LightAPI was built from the latest commit 3a1aacb. The method
ru.beykerykt.minecraft.lightapi.common.LightAPI.createLight
is calling withtype=LightType.BLOCK
. Exception:Problem here:
net.minecraft.server.v1_14_R1.LightEngineStorage.i
Possibly var4 is null.
I think this is because bukkit does not stores that empty section (memory optimization). Bukkit assumes that lights can be spawned only at non-air-blocks. And light source can be spread maximum with 15 blocks and affects maximum only neighbour sections. So, bukkit stores only those empty sections that have atleast one non-empty neighbour section and no more.
Could you find workaround for this problem?
There are two ways:
NibbleArray
(I've checked it). Also, I think this will unreasonable increase storage in mca fileNibbleArray
in the section. But I do not know how to make the check more correct.I think the second way is more realistic :smiley: ATM I use the second way, but with bad implementation. I use something like: