From e4b5a7cb93fca1ddfd6470c6b30bf34e33acf3f3 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 18 Feb 2023 09:28:58 -0600 Subject: [PATCH] rename several FullData objects --- .../main/java/com/seibel/lod/core/Initializer.java | 4 ++-- .../seibel/lod/core/datatype/IFullDataSource.java | 4 ++-- .../com/seibel/lod/core/datatype/IRenderSource.java | 4 ++-- .../lod/core/datatype/PlaceHolderRenderSource.java | 4 ++-- .../core/datatype/column/ColumnRenderSource.java | 4 ++-- ...{ChunkSizedData.java => ChunkSizedFullData.java} | 4 ++-- .../lod/core/datatype/full/FullDataSource.java | 2 +- ...taLoader.java => SingleChunkFullDataLoader.java} | 4 ++-- .../datatype/full/SingleChunkFullDataSource.java | 2 +- .../core/datatype/transform/ChunkToLodBuilder.java | 13 ++++++------- .../datatype/transform/FullToColumnTransformer.java | 2 +- .../lod/core/datatype/transform/LodDataBuilder.java | 6 +++--- .../core/file/fullDatafile/FullDataFileHandler.java | 6 +++--- .../core/file/fullDatafile/FullDataMetaFile.java | 8 ++++---- .../fullDatafile/GeneratedFullDataFileHandler.java | 4 ++-- .../file/fullDatafile/IFullDataSourceProvider.java | 4 ++-- .../file/renderfile/ILodRenderSourceProvider.java | 4 ++-- .../lod/core/file/renderfile/RenderFileHandler.java | 8 +++----- .../core/file/renderfile/RenderMetaDataFile.java | 4 ++-- .../subDimMatching/SubDimensionLevelMatcher.java | 10 +++++----- .../lod/core/generation/WorldGenerationQueue.java | 4 ++-- .../tasks/AbstractWorldGenTaskTracker.java | 4 ++-- .../lod/core/generation/tasks/SplitTaskTracker.java | 4 ++-- .../core/generation/tasks/WorldGenTaskGroup.java | 6 +++--- .../seibel/lod/core/level/DhClientServerLevel.java | 6 +++--- 25 files changed, 61 insertions(+), 64 deletions(-) rename core/src/main/java/com/seibel/lod/core/datatype/full/{ChunkSizedData.java => ChunkSizedFullData.java} (87%) rename core/src/main/java/com/seibel/lod/core/datatype/full/{SpottyDataLoader.java => SingleChunkFullDataLoader.java} (85%) diff --git a/core/src/main/java/com/seibel/lod/core/Initializer.java b/core/src/main/java/com/seibel/lod/core/Initializer.java index 1e7a1fd5c..6dbe564cc 100644 --- a/core/src/main/java/com/seibel/lod/core/Initializer.java +++ b/core/src/main/java/com/seibel/lod/core/Initializer.java @@ -6,7 +6,7 @@ import com.seibel.lod.core.datatype.column.ColumnRenderLoader; import com.seibel.lod.core.datatype.full.FullDataLoader; import com.seibel.lod.core.datatype.full.SparseDataLoader; import com.seibel.lod.api.DhApiMain; -import com.seibel.lod.core.datatype.full.SpottyDataLoader; +import com.seibel.lod.core.datatype.full.SingleChunkFullDataLoader; import com.seibel.lod.core.render.DhApiRenderProxy; import com.seibel.lod.core.world.DhApiWorldProxy; @@ -23,7 +23,7 @@ public class Initializer ColumnRenderLoader unused = new ColumnRenderLoader(); // Auto register into the loader system FullDataLoader unused2 = new FullDataLoader(); // Auto register into the loader system SparseDataLoader unused3 = new SparseDataLoader(); // Auto register - SpottyDataLoader unused4 = new SpottyDataLoader(); // Auto register + SingleChunkFullDataLoader unused4 = new SingleChunkFullDataLoader(); // Auto register // link Core's config to the API DhApiMain.Delayed.configs = DhApiConfig.INSTANCE; diff --git a/core/src/main/java/com/seibel/lod/core/datatype/IFullDataSource.java b/core/src/main/java/com/seibel/lod/core/datatype/IFullDataSource.java index d01cac319..cc7a28085 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/IFullDataSource.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/IFullDataSource.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.datatype; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.full.FullDataPointIdMap; import com.seibel.lod.core.datatype.full.accessor.SingleFullArrayView; import com.seibel.lod.core.file.fullDatafile.FullDataMetaFile; @@ -18,7 +18,7 @@ public interface IFullDataSource byte getDataVersion(); - void update(ChunkSizedData data); + void update(ChunkSizedFullData data); boolean isEmpty(); diff --git a/core/src/main/java/com/seibel/lod/core/datatype/IRenderSource.java b/core/src/main/java/com/seibel/lod/core/datatype/IRenderSource.java index 596b99cba..aec75729c 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/IRenderSource.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/IRenderSource.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.datatype; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.level.IDhClientLevel; import com.seibel.lod.core.pos.DhSectionPos; import com.seibel.lod.core.render.LodQuadTree; @@ -47,7 +47,7 @@ public interface IRenderSource boolean isEmpty(); - void fastWrite(ChunkSizedData chunkData, IDhClientLevel level); + void fastWrite(ChunkSizedFullData chunkData, IDhClientLevel level); /** Overrides any data that has not been written directly using write(). Skips empty source dataPoints. */ void updateFromRenderSource(IRenderSource source); diff --git a/core/src/main/java/com/seibel/lod/core/datatype/PlaceHolderRenderSource.java b/core/src/main/java/com/seibel/lod/core/datatype/PlaceHolderRenderSource.java index f5fc267ea..96c84eb1a 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/PlaceHolderRenderSource.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/PlaceHolderRenderSource.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.datatype; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.level.IDhClientLevel; import com.seibel.lod.core.pos.DhSectionPos; import com.seibel.lod.core.render.LodQuadTree; @@ -54,7 +54,7 @@ public class PlaceHolderRenderSource implements IRenderSource public boolean isEmpty() { return true; } @Override - public void fastWrite(ChunkSizedData chunkData, IDhClientLevel level) { /* TODO */ } + public void fastWrite(ChunkSizedFullData chunkData, IDhClientLevel level) { /* TODO */ } @Override public void updateFromRenderSource(IRenderSource source) { /* TODO */ } diff --git a/core/src/main/java/com/seibel/lod/core/datatype/column/ColumnRenderSource.java b/core/src/main/java/com/seibel/lod/core/datatype/column/ColumnRenderSource.java index 5ecc1360d..0b89cc180 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/column/ColumnRenderSource.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/column/ColumnRenderSource.java @@ -3,7 +3,7 @@ package com.seibel.lod.core.datatype.column; import com.seibel.lod.core.ModInfo; import com.seibel.lod.core.datatype.column.accessor.*; import com.seibel.lod.core.datatype.column.render.ColumnRenderBuffer; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.transform.FullToColumnTransformer; import com.seibel.lod.core.level.IDhClientLevel; import com.seibel.lod.core.pos.DhSectionPos; @@ -304,7 +304,7 @@ public class ColumnRenderSource implements IRenderSource, IColumnDatatype } @Override - public void fastWrite(ChunkSizedData chunkData, IDhClientLevel level) { FullToColumnTransformer.writeFullDataChunkToColumnData(this, level, chunkData); } + public void fastWrite(ChunkSizedFullData chunkData, IDhClientLevel level) { FullToColumnTransformer.writeFullDataChunkToColumnData(this, level, chunkData); } diff --git a/core/src/main/java/com/seibel/lod/core/datatype/full/ChunkSizedData.java b/core/src/main/java/com/seibel/lod/core/datatype/full/ChunkSizedFullData.java similarity index 87% rename from core/src/main/java/com/seibel/lod/core/datatype/full/ChunkSizedData.java rename to core/src/main/java/com/seibel/lod/core/datatype/full/ChunkSizedFullData.java index 586d9f5de..fb8c90b4d 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/full/ChunkSizedData.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/full/ChunkSizedFullData.java @@ -3,13 +3,13 @@ package com.seibel.lod.core.datatype.full; import com.seibel.lod.core.datatype.full.accessor.FullArrayView; import com.seibel.lod.core.pos.DhLodPos; -public class ChunkSizedData extends FullArrayView +public class ChunkSizedFullData extends FullArrayView { public final byte dataDetail; public final int x; public final int z; - public ChunkSizedData(byte dataDetail, int x, int z) + public ChunkSizedFullData(byte dataDetail, int x, int z) { super(new FullDataPointIdMap(), new long[16 * 16][0], 16); this.dataDetail = dataDetail; diff --git a/core/src/main/java/com/seibel/lod/core/datatype/full/FullDataSource.java b/core/src/main/java/com/seibel/lod/core/datatype/full/FullDataSource.java index 82879f84e..2311dea24 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/full/FullDataSource.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/full/FullDataSource.java @@ -60,7 +60,7 @@ public class FullDataSource extends FullArrayView implements IFullDataSource public SingleFullArrayView tryGet(int x, int z) { return this.get(x, z); } @Override - public void update(ChunkSizedData data) + public void update(ChunkSizedFullData data) { LodUtil.assertTrue(this.sectionPos.getSectionBBoxPos().overlaps(data.getBBoxLodPos())); if (data.dataDetail == 0 && this.getDataDetail() == 0) diff --git a/core/src/main/java/com/seibel/lod/core/datatype/full/SpottyDataLoader.java b/core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataLoader.java similarity index 85% rename from core/src/main/java/com/seibel/lod/core/datatype/full/SpottyDataLoader.java rename to core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataLoader.java index 21254a0f2..7f26bd718 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/full/SpottyDataLoader.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataLoader.java @@ -8,9 +8,9 @@ import com.seibel.lod.core.level.IDhLevel; import java.io.IOException; import java.io.InputStream; -public class SpottyDataLoader extends AbstractDataSourceLoader +public class SingleChunkFullDataLoader extends AbstractDataSourceLoader { - public SpottyDataLoader() { + public SingleChunkFullDataLoader() { super(SingleChunkFullDataSource.class, SingleChunkFullDataSource.TYPE_ID, new byte[]{ SingleChunkFullDataSource.LATEST_VERSION}); } diff --git a/core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataSource.java b/core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataSource.java index 550f4467c..dd72228fb 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataSource.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/full/SingleChunkFullDataSource.java @@ -47,7 +47,7 @@ public class SingleChunkFullDataSource extends FullArrayView implements IIncompl public byte getDataVersion() { return LATEST_VERSION; } @Override - public void update(ChunkSizedData data) + public void update(ChunkSizedFullData data) { LodUtil.assertTrue(this.sectionPos.getSectionBBoxPos().overlaps(data.getBBoxLodPos())); diff --git a/core/src/main/java/com/seibel/lod/core/datatype/transform/ChunkToLodBuilder.java b/core/src/main/java/com/seibel/lod/core/datatype/transform/ChunkToLodBuilder.java index 408956da2..037c16bd5 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/transform/ChunkToLodBuilder.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/transform/ChunkToLodBuilder.java @@ -1,10 +1,9 @@ package com.seibel.lod.core.datatype.transform; -import java.time.Duration; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.logging.ConfigBasedLogger; import com.seibel.lod.core.pos.DhChunkPos; @@ -22,9 +21,9 @@ public class ChunkToLodBuilder private static class Task { final DhChunkPos chunkPos; - final CompletableFuture future; + final CompletableFuture future; - Task(DhChunkPos chunkPos, CompletableFuture future) + Task(DhChunkPos chunkPos, CompletableFuture future) { this.chunkPos = chunkPos; this.future = future; @@ -37,7 +36,7 @@ public class ChunkToLodBuilder - public CompletableFuture tryGenerateData(IChunkWrapper chunk) + public CompletableFuture tryGenerateData(IChunkWrapper chunk) { if (chunk == null) throw new NullPointerException("ChunkWrapper cannot be null!"); @@ -50,7 +49,7 @@ public class ChunkToLodBuilder return null; // Otherwise, it means we're the first to do so. Lets submit our task to this entry. - CompletableFuture future = new CompletableFuture<>(); + CompletableFuture future = new CompletableFuture<>(); taskToBuild.addLast(new Task(chunk.getChunkPos(), future)); return future; } @@ -106,7 +105,7 @@ public class ChunkToLodBuilder { if (LodDataBuilder.canGenerateLodFromChunk(latestChunk)) { - ChunkSizedData data = LodDataBuilder.createChunkData(latestChunk); + ChunkSizedFullData data = LodDataBuilder.createChunkData(latestChunk); if (data != null) { task.future.complete(data); diff --git a/core/src/main/java/com/seibel/lod/core/datatype/transform/FullToColumnTransformer.java b/core/src/main/java/com/seibel/lod/core/datatype/transform/FullToColumnTransformer.java index 830076118..8e69acf63 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/transform/FullToColumnTransformer.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/transform/FullToColumnTransformer.java @@ -94,7 +94,7 @@ public class FullToColumnTransformer { return columnSource; } - public static void writeFullDataChunkToColumnData(ColumnRenderSource render, IDhClientLevel level, ChunkSizedData data) { + public static void writeFullDataChunkToColumnData(ColumnRenderSource render, IDhClientLevel level, ChunkSizedFullData data) { if (data.dataDetail != 0) throw new UnsupportedOperationException("To be implemented"); diff --git a/core/src/main/java/com/seibel/lod/core/datatype/transform/LodDataBuilder.java b/core/src/main/java/com/seibel/lod/core/datatype/transform/LodDataBuilder.java index 7b1fd19ab..f2f568e8e 100644 --- a/core/src/main/java/com/seibel/lod/core/datatype/transform/LodDataBuilder.java +++ b/core/src/main/java/com/seibel/lod/core/datatype/transform/LodDataBuilder.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.datatype.transform; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.full.FullDataPoint; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.util.LodUtil; @@ -12,10 +12,10 @@ import it.unimi.dsi.fastutil.longs.LongArrayList; public class LodDataBuilder { private static final IBlockStateWrapper AIR = SingletonInjector.INSTANCE.get(IWrapperFactory.class).getAirBlockStateWrapper(); - public static ChunkSizedData createChunkData(IChunkWrapper chunk) { + public static ChunkSizedFullData createChunkData(IChunkWrapper chunk) { if (!canGenerateLodFromChunk(chunk)) return null; - ChunkSizedData chunkData = new ChunkSizedData((byte)0, chunk.getChunkPos().x, chunk.getChunkPos().z); + ChunkSizedFullData chunkData = new ChunkSizedFullData((byte)0, chunk.getChunkPos().x, chunk.getChunkPos().z); for (int x=0; x<16; x++) { for (int z=0; z<16; z++) { diff --git a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java index 74477d343..0fbfaaedd 100644 --- a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java +++ b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataFileHandler.java @@ -3,7 +3,7 @@ package com.seibel.lod.core.file.fullDatafile; import com.google.common.collect.HashMultimap; import com.seibel.lod.core.datatype.IFullDataSource; import com.seibel.lod.core.datatype.IIncompleteFullDataSource; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.full.FullDataSource; import com.seibel.lod.core.datatype.full.SingleChunkFullDataSource; import com.seibel.lod.core.datatype.full.SparseFullDataSource; @@ -292,14 +292,14 @@ public class FullDataFileHandler implements IFullDataSourceProvider /** This call is concurrent. I.e. it supports being called by multiple threads at the same time. */ @Override - public void write(DhSectionPos sectionPos, ChunkSizedData chunkData) + public void write(DhSectionPos sectionPos, ChunkSizedFullData chunkData) { DhLodPos chunkPos = new DhLodPos((byte) (chunkData.dataDetail+4), chunkData.x, chunkData.z); LodUtil.assertTrue(chunkPos.overlaps(sectionPos.getSectionBBoxPos()), "Chunk {} does not overlap section {}", chunkPos, sectionPos); chunkPos = chunkPos.convertToDetailLevel((byte) this.minDetailLevel); this.recursiveWrite(new DhSectionPos(chunkPos.detailLevel, chunkPos.x, chunkPos.z), chunkData); } - private void recursiveWrite(DhSectionPos sectionPos, ChunkSizedData chunkData) + private void recursiveWrite(DhSectionPos sectionPos, ChunkSizedFullData chunkData) { FullDataMetaFile metaFile = this.files.get(sectionPos); if (metaFile != null) diff --git a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java index e540d474d..ce4acb33d 100644 --- a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java +++ b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/FullDataMetaFile.java @@ -10,7 +10,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import com.seibel.lod.core.datatype.IFullDataSource; import com.seibel.lod.core.datatype.AbstractDataSourceLoader; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.file.metaData.MetaData; import com.seibel.lod.core.pos.DhLodPos; @@ -46,7 +46,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile //TODO: use ConcurrentAppendSingleSwapContainer instead of below: private static class GuardedMultiAppendQueue { ReentrantReadWriteLock appendLock = new ReentrantReadWriteLock(); - ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue<>(); + ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue<>(); } // ===Concurrent Write stuff=== @@ -140,7 +140,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile // } // } - public void addToWriteQueue(ChunkSizedData datatype) { + public void addToWriteQueue(ChunkSizedFullData datatype) { debugCheck(); DhLodPos chunkPos = new DhLodPos((byte) (datatype.dataDetail + 4), datatype.x, datatype.z); LodUtil.assertTrue(pos.getSectionBBoxPos().overlaps(chunkPos), "Chunk pos {} doesn't overlap with section {}", chunkPos, pos); @@ -377,7 +377,7 @@ public class FullDataMetaFile extends AbstractMetaDataFile { this.swapWriteQueue(); int count = this._backQueue.queue.size(); - for (ChunkSizedData chunk : this._backQueue.queue) + for (ChunkSizedFullData chunk : this._backQueue.queue) { data.update(chunk); } diff --git a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/GeneratedFullDataFileHandler.java b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/GeneratedFullDataFileHandler.java index 473a40859..9cb8e9a30 100644 --- a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/GeneratedFullDataFileHandler.java +++ b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/GeneratedFullDataFileHandler.java @@ -2,7 +2,7 @@ package com.seibel.lod.core.file.fullDatafile; import com.seibel.lod.core.datatype.IFullDataSource; import com.seibel.lod.core.datatype.IIncompleteFullDataSource; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.full.SparseFullDataSource; import com.seibel.lod.core.datatype.full.SingleChunkFullDataSource; import com.seibel.lod.core.generation.tasks.AbstractWorldGenTaskTracker; @@ -158,7 +158,7 @@ public class GeneratedFullDataFileHandler extends FullDataFileHandler public boolean isMemoryAddressValid() { return this.targetData.get() != null; } @Override - public Consumer getConsumer() + public Consumer getConsumer() { if (this.loadedTargetData == null) { diff --git a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/IFullDataSourceProvider.java b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/IFullDataSourceProvider.java index f494e06da..56a4d4e4e 100644 --- a/core/src/main/java/com/seibel/lod/core/file/fullDatafile/IFullDataSourceProvider.java +++ b/core/src/main/java/com/seibel/lod/core/file/fullDatafile/IFullDataSourceProvider.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.file.fullDatafile; import com.seibel.lod.core.datatype.IFullDataSource; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.file.metaData.MetaData; import com.seibel.lod.core.pos.DhSectionPos; @@ -16,7 +16,7 @@ public interface IFullDataSourceProvider extends AutoCloseable { void addScannedFile(Collection detectedFiles); CompletableFuture read(DhSectionPos pos); - void write(DhSectionPos sectionPos, ChunkSizedData chunkData); + void write(DhSectionPos sectionPos, ChunkSizedFullData chunkData); CompletableFuture flushAndSave(); //long getCacheVersion(DhSectionPos sectionPos); diff --git a/core/src/main/java/com/seibel/lod/core/file/renderfile/ILodRenderSourceProvider.java b/core/src/main/java/com/seibel/lod/core/file/renderfile/ILodRenderSourceProvider.java index 17940fd9b..ec6950f89 100644 --- a/core/src/main/java/com/seibel/lod/core/file/renderfile/ILodRenderSourceProvider.java +++ b/core/src/main/java/com/seibel/lod/core/file/renderfile/ILodRenderSourceProvider.java @@ -1,7 +1,7 @@ package com.seibel.lod.core.file.renderfile; import com.seibel.lod.core.datatype.IRenderSource; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.pos.DhSectionPos; import java.io.File; @@ -18,7 +18,7 @@ public interface ILodRenderSourceProvider extends AutoCloseable { CompletableFuture read(DhSectionPos pos); void addScannedFile(Collection detectedFiles); - void write(DhSectionPos sectionPos, ChunkSizedData chunkData); + void write(DhSectionPos sectionPos, ChunkSizedFullData chunkData); CompletableFuture flushAndSave(); /** Returns true if the data was refreshed, false otherwise */ diff --git a/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderFileHandler.java b/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderFileHandler.java index 704d80908..6e6ba0c31 100644 --- a/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderFileHandler.java +++ b/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderFileHandler.java @@ -6,7 +6,7 @@ import com.seibel.lod.core.datatype.PlaceHolderRenderSource; import com.seibel.lod.core.datatype.IRenderSource; import com.seibel.lod.core.datatype.AbstractRenderSourceLoader; import com.seibel.lod.core.datatype.column.ColumnRenderSource; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.transform.DataRenderTransformer; import com.seibel.lod.core.file.fullDatafile.IFullDataSourceProvider; import com.seibel.lod.core.level.IDhClientLevel; @@ -218,12 +218,12 @@ public class RenderFileHandler implements ILodRenderSourceProvider /* This call is concurrent. I.e. it supports multiple threads calling this method at the same time. */ @Override - public void write(DhSectionPos sectionPos, ChunkSizedData chunkData) + public void write(DhSectionPos sectionPos, ChunkSizedFullData chunkData) { this.writeRecursively(sectionPos,chunkData); this.fullDataSourceProvider.write(sectionPos, chunkData); // TODO why is there fullData handling in the render file handler? } - private void writeRecursively(DhSectionPos sectPos, ChunkSizedData chunkData) + private void writeRecursively(DhSectionPos sectPos, ChunkSizedFullData chunkData) { if (!sectPos.getSectionBBoxPos().overlaps(new DhLodPos((byte) (4 + chunkData.dataDetail), chunkData.x, chunkData.z))) { @@ -321,8 +321,6 @@ public class RenderFileHandler implements ILodRenderSourceProvider public IRenderSource onRenderFileLoaded(IRenderSource renderSource, RenderMetaDataFile file) { - // TODO - // if (!this.fullDataSourceProvider.isCacheVersionValid(file.pos, file.metaData.dataVersion.get())) // { this.updateCache(renderSource, file); diff --git a/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderMetaDataFile.java b/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderMetaDataFile.java index 4d295be9c..6299bf21f 100644 --- a/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderMetaDataFile.java +++ b/core/src/main/java/com/seibel/lod/core/file/renderfile/RenderMetaDataFile.java @@ -2,7 +2,7 @@ package com.seibel.lod.core.file.renderfile; import com.seibel.lod.core.datatype.IRenderSource; import com.seibel.lod.core.datatype.AbstractRenderSourceLoader; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.file.metaData.MetaData; import com.seibel.lod.core.level.IDhClientLevel; import com.seibel.lod.core.level.IDhLevel; @@ -86,7 +86,7 @@ public class RenderMetaDataFile extends AbstractMetaDataFile // FIXME: This can cause concurrent modification of LodRenderSource. // Not sure if it will cause issues or not. - public void updateChunkIfNeeded(ChunkSizedData chunkData, IDhClientLevel level) + public void updateChunkIfNeeded(ChunkSizedFullData chunkData, IDhClientLevel level) { DhLodPos chunkPos = new DhLodPos((byte) (chunkData.dataDetail + 4), chunkData.x, chunkData.z); LodUtil.assertTrue(this.pos.getSectionBBoxPos().overlaps(chunkPos), "Chunk pos {} doesn't overlap with section {}", chunkPos, pos); diff --git a/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java b/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java index fd81b48b8..9c57a2e8c 100644 --- a/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java +++ b/core/src/main/java/com/seibel/lod/core/file/subDimMatching/SubDimensionLevelMatcher.java @@ -2,7 +2,7 @@ package com.seibel.lod.core.file.subDimMatching; import com.seibel.lod.core.config.Config; import com.seibel.lod.core.datatype.IFullDataSource; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.full.FullDataPoint; import com.seibel.lod.core.datatype.full.accessor.SingleFullArrayView; import com.seibel.lod.core.datatype.transform.LodDataBuilder; @@ -164,20 +164,20 @@ public class SubDimensionLevelMatcher implements AutoCloseable LOGGER.info("Player block pos in dimension: [" + playerData.playerBlockPos.getX() + "," + playerData.playerBlockPos.getY() + "," + playerData.playerBlockPos.getZ() + "]"); // new chunk data - ChunkSizedData newChunkSizedData = LodDataBuilder.createChunkData(newlyLoadedChunk); + ChunkSizedFullData newChunkSizedFullData = LodDataBuilder.createChunkData(newlyLoadedChunk); long[][][] newChunkData = new long[LodUtil.CHUNK_WIDTH][LodUtil.CHUNK_WIDTH][]; - if (newChunkSizedData != null) + if (newChunkSizedFullData != null) { for (int x = 0; x < LodUtil.CHUNK_WIDTH; x++) { for (int z = 0; z < LodUtil.CHUNK_WIDTH; z++) { - long[] array = newChunkSizedData.get(x, z).getRaw(); + long[] array = newChunkSizedFullData.get(x, z).getRaw(); newChunkData[x][z] = array; } } } - boolean newChunkHasData = newChunkSizedData != null && newChunkSizedData.nonEmptyCount() != 0; + boolean newChunkHasData = newChunkSizedFullData != null && newChunkSizedFullData.nonEmptyCount() != 0; // check if the chunk is actually empty if (!newChunkHasData) diff --git a/core/src/main/java/com/seibel/lod/core/generation/WorldGenerationQueue.java b/core/src/main/java/com/seibel/lod/core/generation/WorldGenerationQueue.java index f8c4e6672..7827e6de5 100644 --- a/core/src/main/java/com/seibel/lod/core/generation/WorldGenerationQueue.java +++ b/core/src/main/java/com/seibel/lod/core/generation/WorldGenerationQueue.java @@ -3,7 +3,7 @@ package com.seibel.lod.core.generation; import com.seibel.lod.api.enums.worldGeneration.EDhApiDistantGeneratorMode; import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator; import com.seibel.lod.core.config.Config; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.transform.LodDataBuilder; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.generation.tasks.*; @@ -674,7 +674,7 @@ public class WorldGenerationQueue implements Closeable private static CompletableFuture startGenerationEvent(IDhApiWorldGenerator worldGenerator, DhChunkPos chunkPosMin, byte granularity, byte targetDataDetail, - Consumer resultConsumer) + Consumer resultConsumer) { EDhApiDistantGeneratorMode generatorMode = Config.Client.WorldGenerator.distantGeneratorMode.get(); return worldGenerator.generateChunks(chunkPosMin.x, chunkPosMin.z, granularity, targetDataDetail, generatorMode, (objectArray) -> diff --git a/core/src/main/java/com/seibel/lod/core/generation/tasks/AbstractWorldGenTaskTracker.java b/core/src/main/java/com/seibel/lod/core/generation/tasks/AbstractWorldGenTaskTracker.java index d580235b1..fc01cc3c8 100644 --- a/core/src/main/java/com/seibel/lod/core/generation/tasks/AbstractWorldGenTaskTracker.java +++ b/core/src/main/java/com/seibel/lod/core/generation/tasks/AbstractWorldGenTaskTracker.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.generation.tasks; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import java.util.function.Consumer; @@ -16,6 +16,6 @@ public abstract class AbstractWorldGenTaskTracker */ public abstract boolean isMemoryAddressValid(); - public abstract Consumer getConsumer(); + public abstract Consumer getConsumer(); } diff --git a/core/src/main/java/com/seibel/lod/core/generation/tasks/SplitTaskTracker.java b/core/src/main/java/com/seibel/lod/core/generation/tasks/SplitTaskTracker.java index ed26aaf5e..4c4fee736 100644 --- a/core/src/main/java/com/seibel/lod/core/generation/tasks/SplitTaskTracker.java +++ b/core/src/main/java/com/seibel/lod/core/generation/tasks/SplitTaskTracker.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.generation.tasks; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import java.util.concurrent.CompletableFuture; import java.util.function.Consumer; @@ -52,6 +52,6 @@ public class SplitTaskTracker extends AbstractWorldGenTaskTracker public boolean isMemoryAddressValid() { return this.isValid; } @Override - public Consumer getConsumer() { return this.parentTracker.getConsumer(); } + public Consumer getConsumer() { return this.parentTracker.getConsumer(); } } diff --git a/core/src/main/java/com/seibel/lod/core/generation/tasks/WorldGenTaskGroup.java b/core/src/main/java/com/seibel/lod/core/generation/tasks/WorldGenTaskGroup.java index 42959394b..3a1665281 100644 --- a/core/src/main/java/com/seibel/lod/core/generation/tasks/WorldGenTaskGroup.java +++ b/core/src/main/java/com/seibel/lod/core/generation/tasks/WorldGenTaskGroup.java @@ -1,6 +1,6 @@ package com.seibel.lod.core.generation.tasks; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.pos.DhLodPos; import java.util.Iterator; @@ -28,13 +28,13 @@ public final class WorldGenTaskGroup - public void accept(ChunkSizedData data) + public void accept(ChunkSizedFullData data) { Iterator tasks = this.generatorTasks.iterator(); while (tasks.hasNext()) { WorldGenTask task = tasks.next(); - Consumer consumer = task.taskTracker.getConsumer(); + Consumer consumer = task.taskTracker.getConsumer(); if (consumer == null) { tasks.remove(); diff --git a/core/src/main/java/com/seibel/lod/core/level/DhClientServerLevel.java b/core/src/main/java/com/seibel/lod/core/level/DhClientServerLevel.java index eca55eefd..76e78f63b 100644 --- a/core/src/main/java/com/seibel/lod/core/level/DhClientServerLevel.java +++ b/core/src/main/java/com/seibel/lod/core/level/DhClientServerLevel.java @@ -3,7 +3,7 @@ package com.seibel.lod.core.level; import com.seibel.lod.api.interfaces.override.worldGenerator.IDhApiWorldGenerator; import com.seibel.lod.core.DependencyInjection.WorldGeneratorInjector; import com.seibel.lod.core.config.AppliedConfigState; -import com.seibel.lod.core.datatype.full.ChunkSizedData; +import com.seibel.lod.core.datatype.full.ChunkSizedFullData; import com.seibel.lod.core.datatype.full.FullDataSource; import com.seibel.lod.core.datatype.transform.ChunkToLodBuilder; import com.seibel.lod.core.file.fullDatafile.IFullDataSourceProvider; @@ -124,7 +124,7 @@ public class DhClientServerLevel implements IDhClientLevel, IDhServerLevel renderState.renderer.bufferHandler.update(); } - private void saveWrites(ChunkSizedData data) + private void saveWrites(ChunkSizedFullData data) { RenderState renderState = this.renderStateRef.get(); DhLodPos pos = data.getBBoxLodPos().convertToDetailLevel(FullDataSource.SECTION_SIZE_OFFSET); @@ -242,7 +242,7 @@ public class DhClientServerLevel implements IDhClientLevel, IDhServerLevel @Override public void updateChunkAsync(IChunkWrapper chunk) { - CompletableFuture future = this.chunkToLodBuilder.tryGenerateData(chunk); + CompletableFuture future = this.chunkToLodBuilder.tryGenerateData(chunk); if (future != null) { future.thenAccept(this::saveWrites);