Use another method for enforcing non nsized generation

This commit is contained in:
s809
2025-02-19 20:15:34 +05:00
parent 45c67d057a
commit fdfab2b3a8
3 changed files with 24 additions and 6 deletions
@@ -48,12 +48,7 @@ public class RemoteWorldRetrievalQueue extends AbstractFullDataNetworkRequestQue
public void startAndSetTargetPos(DhBlockPos2D targetPos) { super.tick(targetPos); }
@Override
public byte lowestDataDetail()
{
return Config.Server.Experimental.enableNSizedGeneration.get()
? LodUtil.BLOCK_DETAIL_LEVEL + 12
: LodUtil.BLOCK_DETAIL_LEVEL;
} // TODO should be the same as what the server's update propagator can provide
public byte lowestDataDetail() { return LodUtil.BLOCK_DETAIL_LEVEL + 12; } // TODO should be the same as what the server's update propagator can provide
@Override
public byte highestDataDetail() { return LodUtil.BLOCK_DETAIL_LEVEL; }
@@ -128,6 +123,18 @@ public class RemoteWorldRetrievalQueue extends AbstractFullDataNetworkRequestQue
return DhSectionPos.getChebyshevSignedBlockDistance(sectionPos, targetPos) <= this.networkState.sessionConfig.getMaxGenerationRequestDistance() * 16;
}
@Override
protected boolean onBeforeRequest(long sectionPos, CompletableFuture<ERequestResult> future)
{
if (DhSectionPos.getDetailLevel(sectionPos) > DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL
&& !Config.Server.Experimental.enableNSizedGeneration.get())
{
future.complete(ERequestResult.REQUIRES_SPLITTING);
return false;
}
return true;
}
@Override
protected String getQueueName() { return "World Remote Generation Queue"; }
@@ -102,6 +102,7 @@ public abstract class AbstractFullDataNetworkRequestQueue implements IDebugRende
protected abstract int getRequestRateLimit();
protected abstract boolean isSectionAllowedToGenerate(long sectionPos, DhBlockPos2D targetPos);
protected abstract boolean onBeforeRequest(long sectionPos, CompletableFuture<ERequestResult> future);
protected abstract String getQueueName();
@@ -216,6 +217,12 @@ public abstract class AbstractFullDataNetworkRequestQueue implements IDebugRende
return;
}
if (!this.onBeforeRequest(sectionPos, entry.future))
{
this.pendingTasksSemaphore.release();
return;
}
Long offsetEntryTimestamp = entry.updateTimestamp != null
? entry.updateTimestamp + this.networkState.getServerTimeOffset()
: null;
@@ -6,6 +6,8 @@ import com.seibel.distanthorizons.core.level.DhClientLevel;
import com.seibel.distanthorizons.core.pos.DhSectionPos;
import com.seibel.distanthorizons.core.pos.blockPos.DhBlockPos2D;
import java.util.concurrent.CompletableFuture;
/**
* This queue only handles LOD updates for
* LODs that were changed when the player wasn't online
@@ -37,6 +39,8 @@ public class SyncOnLoadRequestQueue extends AbstractFullDataNetworkRequestQueue
{
return DhSectionPos.getChebyshevSignedBlockDistance(sectionPos, targetPos) <= this.networkState.sessionConfig.getMaxSyncOnLoadDistance() * 16;
}
@Override
protected boolean onBeforeRequest(long sectionPos, CompletableFuture<ERequestResult> future) { return true; }
@Override
protected String getQueueName() { return "Sync On Login Queue"; }