From 009cfdce93fff97ebdd60f9af6442f79a55f2545 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Wed, 8 Oct 2025 17:27:04 -0500 Subject: [PATCH] Fix VANILLA_CHUNKS API world gen --- .../core/dataObjects/transformers/LodDataBuilder.java | 2 +- .../core/generation/WorldGenerationQueue.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java index 7fe5fd52f..71a68cfd1 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/transformers/LodDataBuilder.java @@ -66,7 +66,7 @@ public class LodDataBuilder public static FullDataSourceV2 createFromChunk(ILevelWrapper levelWrapper, IChunkWrapper chunkWrapper) { // only block lighting is needed here, sky lighting is populated at the data source stage - LodUtil.assertTrue(chunkWrapper.isDhBlockLightingCorrect()); + LodUtil.assertTrue(chunkWrapper.isDhBlockLightingCorrect(), "Provided chunk's DH Block lighting hasn't been baked."); int chunkPosX = chunkWrapper.getChunkPos().getX(); int chunkPosZ = chunkWrapper.getChunkPos().getZ(); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/WorldGenerationQueue.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/WorldGenerationQueue.java index 893ec01c6..fe4d2b9b2 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/generation/WorldGenerationQueue.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/WorldGenerationQueue.java @@ -410,8 +410,15 @@ public class WorldGenerationQueue implements IFullDataSourceRetrievalQueue, IDeb { try { - IChunkWrapper chunk = WRAPPER_FACTORY.createChunkWrapper(generatedObjectArray); - try (FullDataSourceV2 dataSource = LodDataBuilder.createFromChunk(this.level.getLevelWrapper(), chunk)) + IChunkWrapper chunkWrapper = WRAPPER_FACTORY.createChunkWrapper(generatedObjectArray); + + // TODO light data should be pulled (if possible) from the ChunkAccess object itself via ChunkFileReader.readLight + // but this should work for now + ArrayList nearbyChunkList = new ArrayList(); + nearbyChunkList.add(chunkWrapper); + DhLightingEngine.INSTANCE.bakeChunkBlockLighting(chunkWrapper, nearbyChunkList, this.level.hasSkyLight() ? LodUtil.MAX_MC_LIGHT : LodUtil.MIN_MC_LIGHT); + + try (FullDataSourceV2 dataSource = LodDataBuilder.createFromChunk(this.level.getLevelWrapper(), chunkWrapper)) { LodUtil.assertTrue(dataSource != null); dataSourceConsumer.accept(dataSource);