diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/HighDetailIncompleteFullDataSource.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/HighDetailIncompleteFullDataSource.java index 3d4d13e3a..f44f0483a 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/HighDetailIncompleteFullDataSource.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/fullData/sources/HighDetailIncompleteFullDataSource.java @@ -149,29 +149,27 @@ public class HighDetailIncompleteFullDataSource implements IIncompleteFullDataSo int dataDetailLevel = inputStream.readShort(); if (dataDetailLevel != dataFile.baseMetaData.dataDetailLevel) { - throw new IOException(LodUtil.formatLog("Data level mismatch: {} != {}", dataDetailLevel, dataFile.baseMetaData.dataDetailLevel)); + throw new IOException("Data level mismatch: ["+dataDetailLevel+"] != ["+dataFile.baseMetaData.dataDetailLevel+"]"); } // confirm that the detail level is correct int sparseDetail = inputStream.readShort(); if (sparseDetail != SPARSE_UNIT_DETAIL) { - throw new IOException((LodUtil.formatLog("Unexpected sparse detail level: {} != {}", - sparseDetail, SPARSE_UNIT_DETAIL))); + throw new IOException("Unexpected sparse detail level: ["+sparseDetail+"] != ["+SPARSE_UNIT_DETAIL+"]"); } // confirm the scale of the data points is correct int sectionSize = inputStream.readInt(); if (sectionSize != SECTION_SIZE) { - throw new IOException(LodUtil.formatLog( - "Section size mismatch: {} != {} (Currently only 1 section size is supported)", sectionSize, SECTION_SIZE)); + throw new IOException("Section size mismatch: ["+sectionSize+"] != ["+SECTION_SIZE+"] (Currently only 1 section size is supported)"); } int minY = inputStream.readInt(); if (minY != level.getMinY()) { - LOGGER.warn("Data minY mismatch: " + minY + " != " + level.getMinY() + ". Will ignore data's y level"); + LOGGER.warn("Data minY mismatch: [" + minY + "] != [" + level.getMinY() + "]. Will ignore data's y level"); } EDhApiWorldGenerationStep worldGenStep = EDhApiWorldGenerationStep.fromValue(inputStream.readByte()); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataMetaFile.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataMetaFile.java index 9a2c9f74a..52f7ae1f9 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataMetaFile.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/FullDataMetaFile.java @@ -178,7 +178,7 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile implements I - public CompletableFuture getDataSourceWithoutCachingAsync() { return this.getOrLoadCachedDataSourceAsync(false); } + public CompletableFuture getDataSourceWithoutCachingAsync() { return this.getOrLoadCachedDataSourceAsync(true); } public CompletableFuture getOrLoadCachedDataSourceAsync() { return this.getOrLoadCachedDataSourceAsync(true); } /** * Synchronized to help prevent issues where multiple threads try to read as cached and un-cached at the same time. @@ -299,7 +299,7 @@ public class FullDataMetaFile extends AbstractMetaDataContainerFile implements I } catch (Exception ex) { - LOGGER.error("Full Data Load error: "+ ex.getMessage(), ex); + LOGGER.error("Full Data Load error for pos ["+this.pos+"], error: "+ ex.getMessage(), ex); dataSourceLoadFuture.completeExceptionally(ex); dataSourceLoadFutureRef.set(null); diff --git a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataFileHandler.java b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataFileHandler.java index 994f6a567..ffb0444fa 100644 --- a/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataFileHandler.java +++ b/core/src/main/java/com/seibel/distanthorizons/core/file/fullDatafile/GeneratedFullDataFileHandler.java @@ -277,33 +277,16 @@ public class GeneratedFullDataFileHandler extends FullDataFileHandler else if (genTaskResult.success) { // generation completed, update the files and listener(s) + this.flushAndSaveAsync(pos).join(); - try + // FIXME this is a bad fix to prevent full data sources saving incomplete, causing holes in the world after generation. + // The problem appears to be that the save may be happening too quickly, + // potentially happening before the meta file has the newly generated data added to it. + CHUNK_GEN_FINISHED_TIMER.schedule(new TimerTask() { - // timeout necessary in case the flush gets stuck or there are issues down stream - // otherwise the world gen might get stuck and never finish - this.flushAndSaveAsync(pos).get(10_000, TimeUnit.MILLISECONDS); - - - // FIXME this is a bad fix to prevent full data sources saving incompletely, causing holes in the world after generation. - // The problem appears to be that the save may be happening too quickly, - // potentially happening before the meta file has the newly generated data added to it. - CHUNK_GEN_FINISHED_TIMER.schedule(new TimerTask() - { - @Override - public void run() { GeneratedFullDataFileHandler.this.flushAndSaveAsync(pos); } - }, 4_000L); - - } - catch (InterruptedException | TimeoutException e) - { - LOGGER.warn("Unable to flush and save after waiting [10] seconds. Error: "+e.getMessage(), e); - } - catch (ExecutionException e) - { - LOGGER.error("Unexpected issue saving world gen result. Error: "+e.getMessage(), e); - } - + @Override + public void run() { GeneratedFullDataFileHandler.this.flushAndSaveAsync(pos).join(); } + }, 4000L); this.fireOnGenPosSuccessListeners(pos); return;