Add colors to the F3 screen

This commit is contained in:
James Seibel
2026-02-07 14:14:13 -06:00
parent a3c72dbcbc
commit dea3557546
6 changed files with 64 additions and 34 deletions
@@ -27,6 +27,7 @@ import com.seibel.distanthorizons.core.api.internal.chunkUpdating.ChunkUpdateQue
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.config.eventHandlers.IgnoredDimensionCsvHandler;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
import com.seibel.distanthorizons.core.level.DhClientLevel;
import com.seibel.distanthorizons.core.level.IDhLevel;
@@ -443,13 +444,18 @@ public class SharedApi
public String getDebugMenuString()
{
String y = MinecraftTextFormat.YELLOW;
String o = MinecraftTextFormat.ORANGE;
String cf = MinecraftTextFormat.CLEAR_FORMATTING;
String preUpdatingCountStr = F3Screen.NUMBER_FORMAT.format(CHUNK_UPDATE_QUEUE_MANAGER.preUpdateQueue.getQueuedCount());
String updatingCountStr = F3Screen.NUMBER_FORMAT.format(CHUNK_UPDATE_QUEUE_MANAGER.updateQueue.getQueuedCount());
String queuedCountStr = F3Screen.NUMBER_FORMAT.format(CHUNK_UPDATE_QUEUE_MANAGER.getQueuedCount());
String maxUpdateCountStr = F3Screen.NUMBER_FORMAT.format(CHUNK_UPDATE_QUEUE_MANAGER.maxSize);
return "Queued chunk updates: "+"( "+preUpdatingCountStr+" + "+updatingCountStr+" ) [ "+queuedCountStr+" / "+maxUpdateCountStr+" ]";
return "Queued chunk updates: "+"("+y+preUpdatingCountStr+cf+" + "+o+updatingCountStr+cf+") ["+queuedCountStr+"/"+maxUpdateCountStr+"]";
}
@@ -23,6 +23,7 @@ import com.google.common.cache.CacheBuilder;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
import com.seibel.distanthorizons.core.file.fullDatafile.V2.FullDataSourceProviderV2;
import com.seibel.distanthorizons.core.file.fullDatafile.RemoteFullDataSourceProvider;
import com.seibel.distanthorizons.core.file.structure.ISaveStructure;
@@ -314,9 +315,16 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
@Override
public void addDebugMenuStringsToList(List<String> messageList)
{
String o = MinecraftTextFormat.ORANGE;
String y = MinecraftTextFormat.YELLOW;
String g = MinecraftTextFormat.GREEN;
String cf = MinecraftTextFormat.CLEAR_FORMATTING;
String dimName = this.levelWrapper.getDhIdentifier();
boolean rendering = this.clientside.isRendering();
messageList.add("["+dimName+"] rendering: "+(rendering ? "yes" : "no"));
String renderingString = rendering ? (g+"yes"+cf) : (o+"no"+cf);
messageList.add("["+y+dimName+cf+"] rendering: "+renderingString);
this.remoteDataSourceProvider.addDebugMenuStringsToList(messageList);
@@ -21,6 +21,7 @@ package com.seibel.distanthorizons.core.level;
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
import com.seibel.distanthorizons.core.file.structure.ISaveStructure;
import com.seibel.distanthorizons.core.multiplayer.server.ServerPlayerStateManager;
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
@@ -105,9 +106,16 @@ public class DhClientServerLevel extends AbstractDhServerLevel implements IDhCli
public void addDebugMenuStringsToList(List<String> messageList)
{
// header
String o = MinecraftTextFormat.ORANGE;
String y = MinecraftTextFormat.YELLOW;
String g = MinecraftTextFormat.GREEN;
String cf = MinecraftTextFormat.CLEAR_FORMATTING;
String dimName = this.serverLevelWrapper.getDhIdentifier();
boolean rendering = this.clientside.isRendering();
messageList.add("["+dimName+"] rendering: "+(rendering ? "yes" : "no"));
String renderingString = rendering ? (g+"yes"+cf) : (o+"no"+cf);
messageList.add("["+y+dimName+cf+"] rendering: "+renderingString);
super.addDebugMenuStringsToList(messageList);
}
@@ -23,6 +23,7 @@ import com.seibel.distanthorizons.core.api.internal.ClientApi;
import com.seibel.distanthorizons.core.api.internal.SharedApi;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
import com.seibel.distanthorizons.core.jar.ModJarInfo;
import com.seibel.distanthorizons.core.level.IDhLevel;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
@@ -80,18 +81,11 @@ public class F3Screen
*/
public static void addStringToDisplay(List<String> messageList)
{
// multi thread pools
PriorityTaskPicker.Executor worldGenPool = ThreadPoolUtil.getWorldGenExecutor();
PriorityTaskPicker.Executor fileHandlerPool = ThreadPoolUtil.getFileHandlerExecutor();
PriorityTaskPicker.Executor renderLoadingPool = ThreadPoolUtil.getRenderLoadingExecutor();
PriorityTaskPicker.Executor updatePool = ThreadPoolUtil.getUpdatePropagatorExecutor();
PriorityTaskPicker.Executor lodBuilderPool = ThreadPoolUtil.getChunkToLodBuilderExecutor();
PriorityTaskPicker.Executor networkPool = ThreadPoolUtil.getNetworkCompressionExecutor();
String r = MinecraftTextFormat.RED;
String y = MinecraftTextFormat.YELLOW;
String cf = MinecraftTextFormat.CLEAR_FORMATTING;
// single thread pools
ThreadPoolExecutor cleanupPool = ThreadPoolUtil.getCleanupExecutor();
ThreadPoolExecutor beaconCullingPool = ThreadPoolUtil.getBeaconCullingExecutor();
ThreadPoolExecutor migrationPool = ThreadPoolUtil.getFullDataMigrationExecutor();
AbstractDhWorld world = SharedApi.getAbstractDhWorld();
if (world == null)
@@ -113,7 +107,7 @@ public class F3Screen
// render validation error
if (ClientApi.INSTANCE.lastRenderParamValidationMessage != null)
{
messageList.add("Render Validation Err: " + ClientApi.INSTANCE.lastRenderParamValidationMessage);
messageList.add("Render Validation Err: " + r + ClientApi.INSTANCE.lastRenderParamValidationMessage + cf);
}
@@ -128,7 +122,7 @@ public class F3Screen
int detailLevel = DhSectionPos.getDetailLevel(sectionPos);
int posX = DhSectionPos.getX(sectionPos);
int posZ = DhSectionPos.getZ(sectionPos);
messageList.add("LOD Pos: " + detailLevel + "*"+posX+","+posZ);
messageList.add("LOD Pos: "+y+detailLevel+"*"+posX+","+posZ+cf);
}
messageList.add("");
}
@@ -137,16 +131,16 @@ public class F3Screen
if (Config.Client.Advanced.Debugging.F3Screen.showThreadPools.get())
{
// multi thread pools
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("World Gen/Import", worldGenPool));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Render Load", renderLoadingPool));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("File Handler", fileHandlerPool));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Update Propagator", updatePool));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("LOD Builder", lodBuilderPool));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Networking", networkPool));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("World Gen/Import", ThreadPoolUtil.getWorldGenExecutor()));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Render Load", ThreadPoolUtil.getFileHandlerExecutor()));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("File Handler", ThreadPoolUtil.getRenderLoadingExecutor()));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Update Propagator", ThreadPoolUtil.getUpdatePropagatorExecutor()));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("LOD Builder", ThreadPoolUtil.getChunkToLodBuilderExecutor()));
messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Networking", ThreadPoolUtil.getNetworkCompressionExecutor()));
//// single thread pools
//messageList.add(getThreadPoolStatString("Cleanup", cleanupPool));
//messageList.add(getThreadPoolStatString("Beacon Culling", beaconCullingPool));
//messageList.add(getThreadPoolStatString("Migration", migrationPool));
//messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Cleanup", ThreadPoolUtil.getCleanupExecutor()));
//messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Beacon Culling", ThreadPoolUtil.getBeaconCullingExecutor()));
//messageList.add(PriorityTaskPicker.Executor.getThreadPoolStatString("Migration", ThreadPoolUtil.getFullDataMigrationExecutor()));
messageList.add("");
}
@@ -540,22 +540,27 @@ public class PhantomArrayListPool
: "";
messageList.add(name + " - Pools:");
String a = MinecraftTextFormat.AQUA;
String y = MinecraftTextFormat.YELLOW;
String cf = MinecraftTextFormat.CLEAR_FORMATTING;
messageList.add(a+name+cf + " - Pools:");
if (totalByteArrayCount != 0)
{
messageList.add("byte[]: " + bytePoolCount + "/" + byteArrayTotalCount + bytePoolSizeInBytes);
messageList.add("byte[]: " + bytePoolCount + "/" + byteArrayTotalCount + y+bytePoolSizeInBytes+cf);
}
if (totalShortArrayCount != 0)
{
messageList.add("short[]: " + shortPoolCount + "/" + shortArrayTotalCount + shortPoolSizeInBytes);
messageList.add("short[]: " + shortPoolCount + "/" + shortArrayTotalCount + y+shortPoolSizeInBytes+cf);
}
if (totalLongArrayCount != 0)
{
messageList.add("long[]: " + longPoolCount + "/" + longArrayTotalCount + longPoolSizeInBytes);
messageList.add("long[]: " + longPoolCount + "/" + longArrayTotalCount + y+longPoolSizeInBytes+cf);
}
if (totalCharArrayCount != 0)
{
messageList.add("char[]: " + charPoolCount + "/" + charArrayTotalCount + charPoolSizeInBytes);
messageList.add("char[]: " + charPoolCount + "/" + charArrayTotalCount + y+charPoolSizeInBytes+cf);
}
}
@@ -2,6 +2,7 @@ package com.seibel.distanthorizons.core.util.threading;
import com.seibel.distanthorizons.core.config.Config;
import com.seibel.distanthorizons.core.config.listeners.IConfigListener;
import com.seibel.distanthorizons.core.enums.MinecraftTextFormat;
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
import com.seibel.distanthorizons.core.util.objects.RollingAverage;
@@ -369,12 +370,20 @@ public class PriorityTaskPicker
public static String getThreadPoolStatString(String displayName, PriorityTaskPicker.Executor pool)
{
String o = MinecraftTextFormat.ORANGE;
String g = MinecraftTextFormat.GREEN;
String b = MinecraftTextFormat.DARK_BLUE;
String y = MinecraftTextFormat.YELLOW;
String cf = MinecraftTextFormat.CLEAR_FORMATTING;
NumberFormat numberFormat = F3Screen.NUMBER_FORMAT;
String queueSize = (pool != null) ? numberFormat.format(pool.getQueueSize()) : "-";
String completedCount = (pool != null) ? numberFormat.format(pool.getCompletedTaskCount()) : "-";
String message = displayName+", Tasks: "+queueSize+", Done: "+completedCount;
String message = displayName+", Tasks: "+o+queueSize+cf+", Done: "+g+completedCount+cf;
if (pool != null)
{
@@ -383,9 +392,9 @@ public class PriorityTaskPicker
int threadCount = pool.getPoolSize();
boolean threadPoolActive = pool.canRun();
String poolActiveString = threadPoolActive ? "Active" : "Paused";
String poolActiveString = threadPoolActive ? ("Active") : (o+"Paused"+cf);
message += ", "+poolActiveString+": "+activeThreadCount+"/"+threadCount;
message += ", "+poolActiveString+": "+y+activeThreadCount+cf+"/"+threadCount;
// thread runtime
String runTimeAvgStr;
@@ -399,7 +408,7 @@ public class PriorityTaskPicker
runTimeAvgStr = "<0";
}
message += ", Avg: "+runTimeAvgStr+"ms";
message += ", Avg: "+b+runTimeAvgStr+"ms"+cf;
}