From 633544e0b0001d0ec552a48a1cb31e6d65d50ff5 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 15 Mar 2026 16:46:51 -0500 Subject: [PATCH] remove unneeded chunk update warnings --- .../BatchGenerationEnvironment.java | 14 ++++++++------ .../worldGeneration/InternalServerGenerator.java | 14 ++++++++------ coreSubProjects | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java index a2bbc7eaa..87bb106cf 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/BatchGenerationEnvironment.java @@ -83,6 +83,7 @@ import net.minecraft.core.registries.Registries; import net.minecraft.world.level.chunk.ChunkStatus; #else import net.minecraft.world.level.chunk.status.ChunkStatus; +import org.jetbrains.annotations.Nullable; #endif public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironmentWrapper @@ -116,6 +117,8 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm private final IDhServerLevel dhServerLevel; + @Nullable + private final ChunkUpdateQueueManager updateManager; public final InternalServerGenerator internalServerGenerator; public final ChunkFileReader chunkFileReader; @@ -184,6 +187,7 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm public BatchGenerationEnvironment(IDhServerLevel dhServerLevel) { this.dhServerLevel = dhServerLevel; + this.updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(this.dhServerLevel.getServerLevelWrapper()); this.globalParams = new GlobalWorldGenParams(dhServerLevel); this.internalServerGenerator = new InternalServerGenerator(this.globalParams, this.dhServerLevel); this.chunkFileReader = new ChunkFileReader(this.globalParams); @@ -592,10 +596,9 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm // usually ignoring the chunk's position is unnecessary, // but this improves performance if a chunk update event does sneak through - ChunkUpdateQueueManager updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(this.dhServerLevel.getServerLevelWrapper()); - if (updateManager != null) + if (this.updateManager != null) { - updateManager.addPosToIgnore(chunkWrapper.getChunkPos()); + this.updateManager.addPosToIgnore(chunkWrapper.getChunkPos()); } }); @@ -724,10 +727,9 @@ public final class BatchGenerationEnvironment implements IBatchGeneratorEnvironm @Override public void run() { - ChunkUpdateQueueManager updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(BatchGenerationEnvironment.this.dhServerLevel.getServerLevelWrapper()); - if (updateManager != null) + if (BatchGenerationEnvironment.this.updateManager != null) { - updateManager.addPosToIgnore(chunkWrapper.getChunkPos()); + BatchGenerationEnvironment.this.updateManager.removePosToIgnore(chunkWrapper.getChunkPos()); } } }, MS_TO_IGNORE_CHUNK_AFTER_COMPLETION); diff --git a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/InternalServerGenerator.java b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/InternalServerGenerator.java index a356ca0c7..7c4ac1fe8 100644 --- a/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/InternalServerGenerator.java +++ b/common/src/main/java/com/seibel/distanthorizons/common/wrappers/worldGeneration/InternalServerGenerator.java @@ -32,6 +32,7 @@ import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; #else import net.minecraft.world.level.chunk.status.ChunkStatus; +import org.jetbrains.annotations.Nullable; #endif import java.util.*; @@ -75,6 +76,8 @@ public class InternalServerGenerator private final GlobalWorldGenParams params; private final IDhServerLevel dhServerLevel; + @Nullable + private final ChunkUpdateQueueManager updateManager; private final Timer chunkSaveIgnoreTimer = TimerUtil.CreateTimer("ChunkSaveIgnoreTimer"); @@ -87,6 +90,7 @@ public class InternalServerGenerator { this.params = params; this.dhServerLevel = dhServerLevel; + this.updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(this.dhServerLevel.getServerLevelWrapper()); } @@ -237,10 +241,9 @@ public class InternalServerGenerator ServerLevel level = this.params.mcServerLevel; // ignore chunk update events for this position - ChunkUpdateQueueManager updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(this.params.dhServerLevel.getServerLevelWrapper()); - if (updateManager != null) + if (this.updateManager != null) { - updateManager.addPosToIgnore(new DhChunkPos(chunkPos.x, chunkPos.z)); + this.updateManager.removePosToIgnore(new DhChunkPos(chunkPos.x, chunkPos.z)); } #if MC_VER < MC_1_21_5 @@ -304,10 +307,9 @@ public class InternalServerGenerator @Override public void run() { - ChunkUpdateQueueManager updateManager = WorldChunkUpdateManager.INSTANCE.getByLevelWrapper(dhLevel.getServerLevelWrapper()); - if (updateManager != null) + if (InternalServerGenerator.this.updateManager != null) { - updateManager.addPosToIgnore(new DhChunkPos(chunkPos.x, chunkPos.z)); + InternalServerGenerator.this.updateManager.addPosToIgnore(new DhChunkPos(chunkPos.x, chunkPos.z)); } } }, MS_TO_IGNORE_CHUNK_AFTER_COMPLETION); diff --git a/coreSubProjects b/coreSubProjects index 2de50475f..b9984c772 160000 --- a/coreSubProjects +++ b/coreSubProjects @@ -1 +1 @@ -Subproject commit 2de50475f175003ab4315328dc5f7d38b5fc2bef +Subproject commit b9984c7723695b74e67298b117e71e84590c9679