From edaafb5cf00c1eea241d2fcf2836fe9e1403dfff Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 15 Jun 2024 10:37:59 -0500 Subject: [PATCH] Fix saving the chunk hash incorrectly --- .../distanthorizons/core/api/internal/SharedApi.java | 10 ++++++++-- .../distanthorizons/core/sql/repo/ChunkHashRepo.java | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/SharedApi.java b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/SharedApi.java index a5e1279b9..821f9c058 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/api/internal/SharedApi.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/api/internal/SharedApi.java @@ -301,12 +301,18 @@ public class SharedApi { // check if this chunk has been converted into an LOD already int oldChunkHash = dhLevel.getChunkHash(chunkWrapper.getChunkPos()); // shouldn't happen on the render thread since it may take a few moments to run - if (oldChunkHash == chunkWrapper.getBlockBiomeHashCode()) + int newChunkHash = chunkWrapper.getBlockBiomeHashCode(); + if (oldChunkHash == newChunkHash) { // if the chunk hashes are the same then we don't need to bother with lighting the chunk // or creating/updating the LODs + //LOGGER.info("skipping: "+chunkWrapper.getChunkPos()+" "+newChunkHash); return; } + else + { + //LOGGER.info("g: "+chunkWrapper.getChunkPos()+" "+newChunkHash); + } @@ -344,7 +350,7 @@ public class SharedApi } dhLevel.updateChunkAsync(chunkWrapper); - dhLevel.setChunkHash(chunkWrapper.getChunkPos(), chunkWrapper.getBlockBiomeHashCode()); + dhLevel.setChunkHash(chunkWrapper.getChunkPos(), newChunkHash); } catch (Exception e) { diff --git a/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/ChunkHashRepo.java b/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/ChunkHashRepo.java index 4a1a5ada5..ad9152886 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/ChunkHashRepo.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/sql/repo/ChunkHashRepo.java @@ -116,6 +116,7 @@ public class ChunkHashRepo extends AbstractDhRepo int i = 1; statement.setObject(i++, dto.chunkHash); + statement.setObject(i++, System.currentTimeMillis()); // last modified unix time statement.setObject(i++, dto.pos.x); statement.setObject(i++, dto.pos.z);