Merge branch 'main' of https://gitlab.com/jeseibel/distant-horizons-core into feature/generation-distance-limiting

This commit is contained in:
s809
2024-11-21 22:10:31 +05:00
10 changed files with 38 additions and 11 deletions
@@ -38,7 +38,7 @@ public final class ModInfo
public static final String NAME = "DistantHorizons";
/** Human-readable version of NAME */
public static final String READABLE_NAME = "Distant Horizons";
public static final String VERSION = "2.3.0-a-dev";
public static final String VERSION = "2.3.0-b-dev";
/** Returns true if the current build is an unstable developer build, false otherwise. */
public static boolean IS_DEV_BUILD = VERSION.toLowerCase().contains("dev");
@@ -275,7 +275,11 @@ public class ColumnRenderBufferBuilder
// the old logic handled additional cases, but they never appeared to fire,
// so just these two cases should be fine
LodUtil.assertTrue(adjDetailLevel == thisDetailLevel || adjDetailLevel > thisDetailLevel);
boolean expectedDetailLevels = (adjDetailLevel == thisDetailLevel) || (adjDetailLevel > thisDetailLevel);
if (!expectedDetailLevels)
{
LodUtil.assertNotReach("Mismatch between adjacent detail level ["+adjDetailLevel+"] and this render source's detail level ["+thisDetailLevel+"]. Detail levels should be adj >= this.");
}
adjColumnViews[lodDirection.ordinal() - 2] = adjRenderSource.getVerticalDataPointView(xAdj, zAdj);
}
@@ -246,6 +246,10 @@ public class DhLightingEngine
// block light
if (updateBlockLight)
{
// done to prevent a rare issue where the light values are incorrectly set to -1
// TODO why could that happen?
centerChunk.clearDhBlockLighting();
this.propagateChunkLightPosList(blockLightWorldPosQueue, adjacentChunkHolder,
(neighbourChunk, relBlockPos) -> neighbourChunk.getDhBlockLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ()),
(neighbourChunk, relBlockPos, newLightValue) -> neighbourChunk.setDhBlockLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ(), newLightValue),
@@ -255,6 +259,8 @@ public class DhLightingEngine
// sky light
if (updateSkyLight)
{
centerChunk.clearDhSkyLighting();
this.propagateChunkLightPosList(skyLightWorldPosQueue, adjacentChunkHolder,
(neighbourChunk, relBlockPos) -> neighbourChunk.getDhSkyLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ()),
(neighbourChunk, relBlockPos, newLightValue) -> neighbourChunk.setDhSkyLight(relBlockPos.getX(), relBlockPos.getY(), relBlockPos.getZ(), newLightValue),
@@ -191,7 +191,7 @@ public class WorldGenModule implements Closeable
String waitingCountStr = F3Screen.NUMBER_FORMAT.format(worldGenState.worldGenerationQueue.getWaitingTaskCount());
String inProgressCountStr = F3Screen.NUMBER_FORMAT.format(worldGenState.worldGenerationQueue.getInProgressTaskCount());
String totalCountEstimateStr = F3Screen.NUMBER_FORMAT.format(worldGenState.worldGenerationQueue.getEstimatedTotalTaskCount());
messageList.add("World Gen Tasks: ${waitingCountStr}/${totalCountEstimateStr} (in progress: ${inProgressCountStr})");
messageList.add("World Gen Tasks: "+waitingCountStr+"/"+totalCountEstimateStr+" (in progress "+inProgressCountStr+")");
worldGenState.worldGenerationQueue.addDebugMenuStringsToList(messageList);
}
@@ -20,12 +20,16 @@
package com.seibel.distanthorizons.core.logging.f3;
import com.seibel.distanthorizons.core.api.internal.SharedApi;
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
import com.seibel.distanthorizons.core.jar.ModJarInfo;
import com.seibel.distanthorizons.core.level.IDhLevel;
import com.seibel.distanthorizons.core.pos.DhSectionPos;
import com.seibel.distanthorizons.core.render.RenderBufferHandler;
import com.seibel.distanthorizons.core.render.renderer.generic.GenericObjectRenderer;
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
import com.seibel.distanthorizons.core.world.AbstractDhWorld;
import com.seibel.distanthorizons.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
import com.seibel.distanthorizons.coreapi.DependencyInjection.DependencyInjector;
import com.seibel.distanthorizons.coreapi.ModInfo;
import com.seibel.distanthorizons.coreapi.util.StringUtil;
import org.apache.logging.log4j.LogManager;
@@ -38,6 +42,7 @@ import java.util.concurrent.ThreadPoolExecutor;
public class F3Screen
{
private static final Logger LOGGER = LogManager.getLogger();
private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
public static final NumberFormat NUMBER_FORMAT = NumberFormat.getIntegerInstance();
@@ -88,6 +93,11 @@ public class F3Screen
{
messageList.add("Build: " + StringUtil.shortenString(ModJarInfo.Git_Commit, 8) + " (" + ModJarInfo.Git_Branch + ")");
}
if (MC_CLIENT != null)
{
// player pos
messageList.add("LOD Pos: " + DhSectionPos.toString(DhSectionPos.encodeContaining(DhSectionPos.SECTION_BLOCK_DETAIL_LEVEL, MC_CLIENT.getPlayerChunkPos())) );
}
messageList.add("");
// thread pools
messageList.add(getThreadPoolStatString("World Gen", worldGenPool));//"World Gen Tasks: 40/5304, (in progress: 7)");
@@ -82,7 +82,7 @@ public class ClientNetworkState implements Closeable
}
this.serverTimeOffset = message.serverTime - System.currentTimeMillis();
LOGGER.info("Server time offset: [${this.serverTimeOffset}] ms");
LOGGER.info("Server time offset: ["+this.serverTimeOffset+"] ms");
});
this.networkSession.registerHandler(CloseInternalEvent.class, message ->
@@ -12,7 +12,8 @@ public class LevelInitMessage extends AbstractNetworkMessage
// prefix@namespace:path
// 1-150 characters in total, all parts except namespace can be omitted
public static final String VALIDATION_REGEX = "^(?=.{1,$MAX_LENGTH}$)([$PART_ALLOWED_CHARS_REGEX]+@)?[$PART_ALLOWED_CHARS_REGEX]+(:[$PART_ALLOWED_CHARS_REGEX]+)?$";
public static final String VALIDATION_REGEX = String.format("^(?=.{1,%s}$)([%s]+@)?[%s]+(:[%s]+)?$",
+ MAX_LENGTH, PART_ALLOWED_CHARS_REGEX, PART_ALLOWED_CHARS_REGEX, PART_ALLOWED_CHARS_REGEX);
public String levelKey;
@@ -345,9 +345,15 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
// prepare this section for rendering
if (!renderSection.gpuUploadInProgress()
&& renderSection.renderBuffer == null
// this check is specifically for N-sized world generators where the higher quality
// data source may not exist yet
&& renderSection.getFullDataSourceExists())
&&
(
// this check is specifically for N-sized world generators where the higher quality
// data source may not exist yet, this is done to prevent holes while waiting for said generator
renderSection.getFullDataSourceExists()
// if we can't request generation we don't want to check for full data existing
// since that will prevent server LODs from loading high-detail LODs where quadrants haven't been generated.
|| !this.fullDataSourceProvider.canQueueRetrieval())
)
{
nodesNeedingLoading.add(renderSection);
}
@@ -424,7 +430,7 @@ public class LodQuadTree extends QuadTree<LodRenderSection> implements IDebugRen
if (renderSection != null)
{
// this data source may now exist
renderSection.updateFullDataSourceExists();
renderSection.updateFullDataSourceExists();
if (renderSection.canRender())
{
@@ -69,7 +69,7 @@ public abstract class AbstractDhWorld implements IDhWorld, Closeable
readOnlyStr += " - ReadOnly";
}
String message = "${environment} World with ${levelCountStr} levels${readOnlyStr}";
String message = environment+" World with "+levelCountStr+" levels"+readOnlyStr;
messageList.add(message);
}
+1 -1
View File
@@ -255,7 +255,7 @@ float calculateHeightFogDepth(float worldYPos)
else
{
// shouldn't happen,
return 0;
return 0.0;
}
}