fix world reset chunk repop

This commit is contained in:
Sen 2025-07-11 12:33:53 +02:00
parent c261317be9
commit 0c6ea439eb
Signed by: sen
GPG key ID: 3AC50A6F47D1B722

View file

@ -1256,7 +1256,7 @@ public final class WorldServer extends AWorldServer {
this.chunks.add(id, chunk);
this.loaded.add(chunk);
chunk.onChunkLoad();
this.popChunk(x, z);
this.popChunk(x, z, false);
}
return chunk;
@ -1386,7 +1386,7 @@ public final class WorldServer extends AWorldServer {
// }
// }
private void popChunk(int x, int z) {
private void popChunk(int x, int z, boolean force) {
boolean n = this.chunkExists(x, z - 1);
boolean e = this.chunkExists(x + 1, z);
boolean s = this.chunkExists(x, z + 1);
@ -1398,6 +1398,15 @@ public final class WorldServer extends AWorldServer {
if(e && s && se) {
this.populate(x, z);
}
else if(force) {
if(!e)
this.loadChunk(x + 1, z);
if(!s)
this.loadChunk(x, z + 1);
if(!se)
this.loadChunk(x + 1, z + 1);
this.populate(x, z);
}
if(w && s && sw) {
this.populate(x - 1, z);
}
@ -1587,8 +1596,10 @@ public final class WorldServer extends AWorldServer {
// chunk.checkLight();
// chunk.setModified(true);
}
for(ChunkServer chunk : this.loaded) {
this.popChunk(chunk.xPos, chunk.zPos);
loaded.clear();
loaded.addAll(this.loaded);
for(ChunkServer chunk : loaded) {
this.popChunk(chunk.xPos, chunk.zPos, true);
chunk.update(false);
}
this.entities.removeAll(this.unloaded);