mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-07 00:48:28 +01:00
More aggressive lighting delay, resend neighbour lighting data after chunk generation (#16)
This commit is contained in:
parent
5afce81de5
commit
9c6cb1796c
@ -214,24 +214,24 @@ public class LightingChunk extends DynamicChunk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendingTask == null) {
|
if (sendingTask != null) sendingTask.cancel();
|
||||||
sendingTask = MinecraftServer.getSchedulerManager().scheduleTask(() -> {
|
sendingTask = MinecraftServer.getSchedulerManager().scheduleTask(() -> {
|
||||||
sendingTask = null;
|
sendingTask = null;
|
||||||
|
|
||||||
for (LightingChunk f : sendQueue) {
|
for (LightingChunk f : sendQueue) {
|
||||||
if (f.isLoaded()) {
|
if (f.isLoaded()) {
|
||||||
f.sections.forEach(s -> {
|
f.sections.forEach(s -> {
|
||||||
s.blockLight().invalidate();
|
s.blockLight().invalidate();
|
||||||
s.skyLight().invalidate();
|
s.skyLight().invalidate();
|
||||||
});
|
});
|
||||||
f.sendLighting();
|
sendQueue.remove(f);
|
||||||
sendQueue.remove(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
f.chunkCache.invalidate();
|
f.chunkCache.invalidate();
|
||||||
|
f.lightCache.invalidate();
|
||||||
|
f.sendLighting();
|
||||||
}
|
}
|
||||||
}, TaskSchedule.tick(5), TaskSchedule.stop(), ExecutionType.ASYNC);
|
}
|
||||||
}
|
}, TaskSchedule.tick(10), TaskSchedule.stop(), ExecutionType.ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void flushQueue(Instance instance, Set<Point> queue, LightType type) {
|
private static void flushQueue(Instance instance, Set<Point> queue, LightType type) {
|
||||||
@ -338,7 +338,7 @@ public class LightingChunk extends DynamicChunk {
|
|||||||
if (c == null) return;
|
if (c == null) return;
|
||||||
|
|
||||||
Set<Point> collected = collectRequiredNearby(instance, new Vec(chunkX, sectionY, chunkZ));
|
Set<Point> collected = collectRequiredNearby(instance, new Vec(chunkX, sectionY, chunkZ));
|
||||||
// System.out.println("Calculating " + chunkX + " " + sectionY + " " + chunkZ + " | " + collected.size());
|
// System.out.println("Calculating " + chunkX + " " + sectionY + " " + chunkZ + " | " + collected.size() + " | " + type);
|
||||||
|
|
||||||
synchronized (instance) {
|
synchronized (instance) {
|
||||||
relight(instance, collected, type);
|
relight(instance, collected, type);
|
||||||
|
Loading…
Reference in New Issue
Block a user