Ignore local chunks if realtime updates are enabled

This commit is contained in:
s809
2025-01-23 23:21:13 +05:00
parent e0a0ba5222
commit cdca7723a7
3 changed files with 12 additions and 2 deletions
@@ -25,6 +25,7 @@ import com.seibel.distanthorizons.core.Initializer;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
import com.seibel.distanthorizons.core.level.DhClientLevel;
import com.seibel.distanthorizons.core.level.IDhLevel;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
@@ -231,6 +232,14 @@ public class SharedApi
return;
}
if (dhLevel instanceof DhClientLevel)
{
if (!((DhClientLevel) dhLevel).shouldProcessLocalChunkUpdates())
{
return;
}
}
// shoudln't normally happen, but just in case
if (UPDATE_POS_MANAGER.contains(chunkWrapper.getChunkPos()))
{
@@ -278,8 +278,7 @@ public abstract class AbstractDhServerLevel extends AbstractDhLevel implements I
Vec3d playerPosition = serverPlayerState.getServerPlayer().getPosition();
int distanceFromPlayer = DhSectionPos.getChebyshevSignedBlockDistance(data.getPos(), new DhBlockPos2D((int) playerPosition.x, (int) playerPosition.z)) / 16;
if (distanceFromPlayer >= serverPlayerState.getServerPlayer().getViewDistance()
&& distanceFromPlayer <= serverPlayerState.sessionConfig.getMaxUpdateDistanceRadius())
if (distanceFromPlayer <= serverPlayerState.sessionConfig.getMaxUpdateDistanceRadius())
{
serverPlayerState.fullDataPayloadSender.sendInChunks(payload, () ->
{
@@ -283,6 +283,8 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
return (renderState != null) ? renderState.renderBufferHandler : null;
}
public boolean shouldProcessLocalChunkUpdates() { return this.networkState == null || !this.networkState.sessionConfig.isRealTimeUpdatesEnabled(); }
//===========//