From 8f8d7c40889c7047b9be7898aa56283a9abadc1d Mon Sep 17 00:00:00 2001 From: lhofhansl Date: Fri, 28 Mar 2025 11:31:54 -0700 Subject: [PATCH] Check if a block is already in the emege queue before checking occlusion culling and trying to reemerge (#15949) --- src/server/clientiface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/server/clientiface.cpp b/src/server/clientiface.cpp index d05fedbb2..8a8a6cf1b 100644 --- a/src/server/clientiface.cpp +++ b/src/server/clientiface.cpp @@ -339,6 +339,15 @@ void RemoteClient::GetNextBlocks ( if (d >= d_opt && block->isAir()) continue; } + + const bool want_emerge = !block || !block->isGenerated(); + + // if the block is already in the emerge queue we don't have to check again + if (want_emerge && emerge->isBlockInQueue(p)) { + nearest_emerged_d = d; + continue; + } + /* Check occlusion cache first. */ @@ -357,7 +366,7 @@ void RemoteClient::GetNextBlocks ( /* Add inexistent block to emerge queue. */ - if (!block || !block->isGenerated()) { + if (want_emerge) { if (emerge->enqueueBlockEmerge(peer_id, p, generate)) { if (nearest_emerged_d == -1) nearest_emerged_d = d;