1
0
Fork 0

add option for immediate light updates

This commit is contained in:
Sen 2025-09-01 17:14:34 +02:00
parent 364ada6346
commit 3bc5181273
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
5 changed files with 72 additions and 11 deletions

View file

@ -564,6 +564,8 @@ public class Client implements IThreadListener {
private int lightUpdates = 2048;
@Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 1024, display = "Radius Licht-Updates")
private int lightRange = 32;
@Variable(name = "chunk_light_onload", category = CVarCategory.RENDER, min = 0, max = 32, display = "Licht-Init. / Tick")
private int lightInit = 0;
@Variable(name = "draw_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
public float fov = 70.0f;
@Variable(name = "draw_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
@ -3645,7 +3647,20 @@ public class Client implements IThreadListener {
}
}
Set<ChunkPos> active = this.world.setActiveChunks(this.renderDistance);
Set<ChunkPos> active = this.world.getActiveChunks();
active.clear();
if(this.player != null) {
int x = ExtMath.floord(this.player.posX / 16.0D);
int z = ExtMath.floord(this.player.posZ / 16.0D);
for(int cx = -this.renderDistance; cx <= this.renderDistance; cx++) {
for(int cz = -this.renderDistance; cz <= this.renderDistance; cz++) {
active.add(new ChunkPos(cx + x, cz + z));
if(this.lightInit > 0)
this.getChunk(cx + x, cz + z).updateLight(this.lightInit);
}
}
}
this.previousActive.retainAll(active);
if (this.previousActive.size() == active.size())
{
@ -3658,8 +3673,6 @@ public class Client implements IThreadListener {
{
if (!this.previousActive.contains(chunkcoordintpair))
{
int j = chunkcoordintpair.x * 16;
int k = chunkcoordintpair.z * 16;
ChunkClient chunk = this.getChunk(chunkcoordintpair.x, chunkcoordintpair.z);
this.previousActive.add(chunkcoordintpair);
++i;