3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00

Use getChunkForLighting instead of getChunkAtImmediately in fixlight to properly ignore imposter chunks

We need chunks to actually have their light status future done to relight them, an imposter with for example only the empty future complete but with a light status cannot be relit.

getChunkForLighting gives the desired behavior and is the method used by the light engine, so updating fixlight to use it as well fixes #8115
Dieser Commit ist enthalten in:
Jason Penilla 2022-07-08 15:27:37 -07:00
Ursprung 41238a4e24
Commit 5ffeb70186
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0E75A301420E48F8

Datei anzeigen

@ -4358,7 +4358,7 @@ index 0000000000000000000000000000000000000000..dd995e25ae620ae36cd5eecb2fe10ad0
+
+}
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index a538473f4a75791c7c657f9f1e3ddf96042ab071..a96b3f62a7a6aa5c87976dcda93f4b47bc2cd252 100644
index a538473f4a75791c7c657f9f1e3ddf96042ab071..86c41f9ad92dc5fb762d56107f58e3acc07d8890 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -709,6 +709,46 @@ public class PaperCommand extends Command {
@ -4374,7 +4374,7 @@ index a538473f4a75791c7c657f9f1e3ddf96042ab071..a96b3f62a7a6aa5c87976dcda93f4b47
+ for (java.util.Iterator<ChunkPos> iterator = chunks.iterator(); iterator.hasNext();) {
+ final ChunkPos chunkPos = iterator.next();
+
+ final net.minecraft.world.level.chunk.ChunkAccess chunk = world.getChunkSource().getChunkAtImmediately(chunkPos.x, chunkPos.z);
+ final net.minecraft.world.level.chunk.ChunkAccess chunk = (net.minecraft.world.level.chunk.ChunkAccess) world.getChunkSource().getChunkForLighting(chunkPos.x, chunkPos.z);
+ if (chunk == null || !chunk.isLightCorrect() || !chunk.getStatus().isOrAfter(net.minecraft.world.level.chunk.ChunkStatus.LIGHT)) {
+ // cannot relight this chunk
+ iterator.remove();
@ -4471,7 +4471,7 @@ index 537d34a0325a985948c744929b90144a66a35ee3..06e4d3a02e0d1326b7029157856476db
while (objectiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
index 5539f2a7e069cbe98997b734f3b1cd498148f09b..53a4bf5815eb05bf1a4c82c08dd5a51c9ce913b8 100644
index 5539f2a7e069cbe98997b734f3b1cd498148f09b..b57bffce30154b196b879209c1ce559d0b82456e 100644
--- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
+++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java
@@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter;
@ -4536,7 +4536,7 @@ index 5539f2a7e069cbe98997b734f3b1cd498148f09b..53a4bf5815eb05bf1a4c82c08dd5a51c
+ for (java.util.Iterator<ChunkPos> iterator = chunks.iterator(); iterator.hasNext();) {
+ final ChunkPos chunkPos = iterator.next();
+
+ final ChunkAccess chunk = ((ServerLevel)this.theLightEngine.getWorld()).getChunkSource().getChunkAtImmediately(chunkPos.x, chunkPos.z);
+ final ChunkAccess chunk = (ChunkAccess)((ServerLevel)this.theLightEngine.getWorld()).getChunkSource().getChunkForLighting(chunkPos.x, chunkPos.z);
+ if (chunk == null || !chunk.isLightCorrect() || !chunk.getStatus().isOrAfter(ChunkStatus.LIGHT)) {
+ // cannot relight this chunk
+ iterator.remove();