From 6595f5d90efccac02f5a3c635bc45f11cfb0d3d3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Nov 2024 21:57:58 -0600 Subject: [PATCH 1/9] Fix fog shader compiling on some software renderers --- core/src/main/resources/shaders/fog/fog.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/shaders/fog/fog.frag b/core/src/main/resources/shaders/fog/fog.frag index a4495bd82..d4982674d 100644 --- a/core/src/main/resources/shaders/fog/fog.frag +++ b/core/src/main/resources/shaders/fog/fog.frag @@ -255,7 +255,7 @@ float calculateHeightFogDepth(float worldYPos) else { // shouldn't happen, - return 0; + return 0.0; } } From 37dd0c4d55e94b638307f9b51c76c541acb768aa Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 16 Nov 2024 22:07:31 -0600 Subject: [PATCH 2/9] up version number 2.3.0-a -> 2.3.0-b --- .../main/java/com/seibel/distanthorizons/coreapi/ModInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java b/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java index 74779b072..c3652eed6 100644 --- a/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java +++ b/api/src/main/java/com/seibel/distanthorizons/coreapi/ModInfo.java @@ -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"); From bcc44ab5e3230ddff78c658e1c567779335ebc6c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 17 Nov 2024 06:22:48 -0600 Subject: [PATCH 3/9] Add player's DhSectionPos to the F3 menu --- .../distanthorizons/core/logging/f3/F3Screen.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/logging/f3/F3Screen.java b/core/src/main/java/com/seibel/distanthorizons/core/logging/f3/F3Screen.java index 8c1011974..ed5cbecd4 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/logging/f3/F3Screen.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/logging/f3/F3Screen.java @@ -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)"); From 9f966f0643f2612e7e9c398ca31d157ef00c25f6 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sun, 17 Nov 2024 08:03:04 -0600 Subject: [PATCH 4/9] Remove manifold string plugin --- .../com/seibel/distanthorizons/core/level/WorldGenModule.java | 2 +- .../core/multiplayer/client/ClientNetworkState.java | 2 +- .../com/seibel/distanthorizons/core/world/AbstractDhWorld.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/level/WorldGenModule.java b/core/src/main/java/com/seibel/distanthorizons/core/level/WorldGenModule.java index 847b186e5..3036013c1 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/level/WorldGenModule.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/level/WorldGenModule.java @@ -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); } diff --git a/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/client/ClientNetworkState.java b/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/client/ClientNetworkState.java index 3246fa015..f3abf60cd 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/client/ClientNetworkState.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/multiplayer/client/ClientNetworkState.java @@ -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 -> diff --git a/core/src/main/java/com/seibel/distanthorizons/core/world/AbstractDhWorld.java b/core/src/main/java/com/seibel/distanthorizons/core/world/AbstractDhWorld.java index 17615a238..233d101a2 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/world/AbstractDhWorld.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/world/AbstractDhWorld.java @@ -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); } From deaccf53f98f804edd77f46dfaa6aff8cc6976e9 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 18 Nov 2024 07:40:16 -0600 Subject: [PATCH 5/9] Fix sometimes not loading high-detail LODs when on a server --- .../distanthorizons/core/render/LodQuadTree.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java index dd0b123ea..f12d215de 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java @@ -345,9 +345,15 @@ public class LodQuadTree extends QuadTree 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 implements IDebugRen if (renderSection != null) { // this data source may now exist - renderSection.updateFullDataSourceExists(); + renderSection.updateFullDataSourceExists(); if (renderSection.canRender()) { From eb749d6bb04bdbd96b121af05bbd68780089afb0 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Mon, 18 Nov 2024 07:46:24 -0600 Subject: [PATCH 6/9] Fix a rare error where chunk lighting is set to -1 --- .../distanthorizons/core/generation/DhLightingEngine.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java index 8a1584a73..f2448593e 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java @@ -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), From f7926456a3f8f32cb406bc6f9f0c918998c44d4b Mon Sep 17 00:00:00 2001 From: helpimnotdrowning <5190181-helpimnotdrowning@users.noreply.gitlab.com> Date: Tue, 19 Nov 2024 16:15:23 -0600 Subject: [PATCH 7/9] Fix distant-horizons#870: Correctly template regex --- .../core/network/messages/base/LevelInitMessage.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/network/messages/base/LevelInitMessage.java b/core/src/main/java/com/seibel/distanthorizons/core/network/messages/base/LevelInitMessage.java index 7f8d13a96..9ae276bed 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/network/messages/base/LevelInitMessage.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/network/messages/base/LevelInitMessage.java @@ -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; From 6ff2c9f14c1fbf2ba643e9ea18fb80c89cb0d56c Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 21 Nov 2024 07:17:20 -0600 Subject: [PATCH 8/9] improve columnRenderbuffer assertion message --- .../render/bufferBuilding/ColumnRenderBufferBuilder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java index 17f37ad5e..5839a3cfe 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java @@ -275,7 +275,10 @@ 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); + if (adjDetailLevel == thisDetailLevel || adjDetailLevel > thisDetailLevel) + { + 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); } From 23c160e948d307eb0a5791399dbf15e3398e8236 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 21 Nov 2024 07:41:31 -0600 Subject: [PATCH 9/9] Accidentally flipped an assertion last commit --- .../render/bufferBuilding/ColumnRenderBufferBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java index 5839a3cfe..4f5898b60 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java @@ -275,7 +275,8 @@ public class ColumnRenderBufferBuilder // the old logic handled additional cases, but they never appeared to fire, // so just these two cases should be fine - if (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."); }