Fix saving the chunk hash incorrectly

This commit is contained in:
James Seibel
2024-06-15 10:37:59 -05:00
parent 81d1ed419e
commit edaafb5cf0
2 changed files with 9 additions and 2 deletions
@@ -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)
{
@@ -116,6 +116,7 @@ public class ChunkHashRepo extends AbstractDhRepo<DhChunkPos, ChunkHashDTO>
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);