Add debug options to skip some full data update events

This commit is contained in:
James Seibel
2023-09-08 22:32:19 -05:00
parent b234c3e57e
commit 1e7b459b6a
4 changed files with 37 additions and 4 deletions
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.core.api.internal;
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiLevelLoadEvent;
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiLevelUnloadEvent;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
import com.seibel.distanthorizons.core.util.ThreadUtil;
import com.seibel.distanthorizons.core.wrapperInterfaces.misc.IServerPlayerWrapper;
@@ -143,6 +144,12 @@ public class ServerApi
public void serverChunkLoadEvent(IChunkWrapper chunk, ILevelWrapper level)
{
if (Config.Client.Advanced.Debugging.skipChunkLoadUpdates.get())
{
return;
}
// the world should always be non-null, this != null is just in case the world was removed accidentally
AbstractDhWorld dhWorld = SharedApi.getAbstractDhWorld();
if (dhWorld != null)
@@ -156,6 +163,12 @@ public class ServerApi
}
public void serverChunkSaveEvent(IChunkWrapper chunkWrapper, ILevelWrapper level)
{
if (Config.Client.Advanced.Debugging.skipChunkUnloadUpdates.get())
{
return;
}
AbstractDhWorld dhWorld = SharedApi.getAbstractDhWorld();
if (dhWorld == null)
{
@@ -1165,6 +1165,24 @@ public class Config
+ "")
.build();
public static ConfigEntry<Boolean> skipChunkLoadUpdates = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("")
.build();
public static ConfigEntry<Boolean> skipChunkUnloadUpdates = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("")
.build();
public static ConfigEntry<Boolean> skipFullDataUpdateQueue = new ConfigEntry.Builder<Boolean>()
.set(false)
.comment("")
.build();
// can be set to public inorder to show in the config file and UI
public static ConfigCategory exampleConfigScreen = new ConfigCategory.Builder()
.set(ExampleConfigScreen.class)
@@ -76,10 +76,6 @@ public class ColumnRenderBufferBuilder
IDhClientLevel clientLevel, Reference<ColumnRenderBuffer> renderBufferRef,
ColumnRenderSource renderSource, ColumnRenderSource[] adjData)
{
/* if (isBusy())
{
return null;
}*/
//LOGGER.info("RenderRegion startBuild @ "+renderSource.sectionPos);
return CompletableFuture.supplyAsync(() ->
{
@@ -28,6 +28,7 @@ import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.CompleteFullDataSource;
import com.seibel.distanthorizons.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.interfaces.IFullDataSource;
@@ -508,6 +509,11 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile implements I
@SuppressWarnings("resource") // due to DataObjTracker and DataObjSoftTracker being created outside a try-catch block
private CompletableFuture<IFullDataSource> applyWriteQueueAndSaveAsync(IFullDataSource fullDataSourceToUpdate)
{
if (Config.Client.Advanced.Debugging.skipFullDataUpdateQueue.get())
{
return CompletableFuture.completedFuture(fullDataSourceToUpdate);
}
CompletableFuture<IFullDataSource> completionFuture = new CompletableFuture<>();