remove unneeded chunk update warnings

This commit is contained in:
James Seibel
2026-03-15 16:46:51 -05:00
parent 2432028aa0
commit 633544e0b0
3 changed files with 17 additions and 13 deletions
@@ -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);
@@ -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);