rename NewFullDataSource -> FullDataSourceV2 and supporting objects
This commit is contained in:
+10
-10
@@ -27,12 +27,12 @@ import com.seibel.distanthorizons.api.interfaces.data.IDhApiTerrainDataRepo;
|
||||
import com.seibel.distanthorizons.api.objects.math.DhApiVec3i;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.FullDataPointIdMap;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.pos.DhLodPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtilV2;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.RayCastUtil;
|
||||
import com.seibel.distanthorizons.core.world.AbstractDhWorld;
|
||||
@@ -211,7 +211,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
|
||||
try
|
||||
{
|
||||
// attempt to get/generate the data source for this section
|
||||
NewFullDataSource dataSource = level.getFullDataProvider().getAsync(sectionPos).get();
|
||||
FullDataSourceV2 dataSource = level.getFullDataProvider().getAsync(sectionPos).get();
|
||||
if (dataSource == null)
|
||||
{
|
||||
return DhApiResult.createFail("Unable to find/generate any data at the " + DhSectionPos.class.getSimpleName() + " [" + sectionPos + "].");
|
||||
@@ -248,8 +248,8 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
|
||||
if (dataPoint != 0)
|
||||
{
|
||||
int requestedY = nullableBlockYPos;
|
||||
int bottomY = FullDataPointUtil.getBottomY(dataPoint) + levelMinimumHeight;
|
||||
int height = FullDataPointUtil.getHeight(dataPoint);
|
||||
int bottomY = FullDataPointUtilV2.getBottomY(dataPoint) + levelMinimumHeight;
|
||||
int height = FullDataPointUtilV2.getHeight(dataPoint);
|
||||
int topY = bottomY + height;
|
||||
|
||||
// does this datapoint contain the requested Y position?
|
||||
@@ -281,15 +281,15 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
|
||||
|
||||
private static DhApiTerrainDataPoint generateApiDatapoint(IDhApiLevelWrapper levelWrapper, FullDataPointIdMap mapping, byte detailLevel, long dataPoint)
|
||||
{
|
||||
IBlockStateWrapper blockState = mapping.getBlockStateWrapper(FullDataPointUtil.getId(dataPoint));
|
||||
IBiomeWrapper biomeWrapper = mapping.getBiomeWrapper(FullDataPointUtil.getId(dataPoint));
|
||||
IBlockStateWrapper blockState = mapping.getBlockStateWrapper(FullDataPointUtilV2.getId(dataPoint));
|
||||
IBiomeWrapper biomeWrapper = mapping.getBiomeWrapper(FullDataPointUtilV2.getId(dataPoint));
|
||||
|
||||
int bottomY = FullDataPointUtil.getBottomY(dataPoint) + levelWrapper.getMinHeight();
|
||||
int height = FullDataPointUtil.getHeight(dataPoint);
|
||||
int bottomY = FullDataPointUtilV2.getBottomY(dataPoint) + levelWrapper.getMinHeight();
|
||||
int height = FullDataPointUtilV2.getHeight(dataPoint);
|
||||
int topY = bottomY + height;
|
||||
|
||||
return new DhApiTerrainDataPoint(detailLevel,
|
||||
FullDataPointUtil.getBlockLight(dataPoint), FullDataPointUtil.getSkyLight(dataPoint),
|
||||
FullDataPointUtilV2.getBlockLight(dataPoint), FullDataPointUtilV2.getSkyLight(dataPoint),
|
||||
topY, bottomY,
|
||||
blockState, biomeWrapper);
|
||||
}
|
||||
|
||||
+6
-3
@@ -39,9 +39,12 @@ import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Formerly "CompleteFullDataSource". <br>
|
||||
* Should be fully populated, containing 1 data point for each column.
|
||||
*
|
||||
* Should be fully populated, containing 1 data point for each column. <br><br>
|
||||
*
|
||||
* Replaced by {@link FullDataSourceV2}.
|
||||
*
|
||||
* @see FullDataPointUtilV1
|
||||
* @see FullDataSourceV2
|
||||
*/
|
||||
public class FullDataSourceV1 implements IDataSource<IDhLevel>
|
||||
{
|
||||
@@ -98,7 +101,7 @@ public class FullDataSourceV1 implements IDataSource<IDhLevel>
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public boolean update(NewFullDataSource dataSource, IDhLevel level) { throw new UnsupportedOperationException("Deprecated"); }
|
||||
public boolean update(FullDataSourceV2 dataSource, IDhLevel level) { throw new UnsupportedOperationException("Deprecated"); }
|
||||
|
||||
|
||||
|
||||
|
||||
+33
-33
@@ -23,11 +23,11 @@ import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGeneratio
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.FullDataPointIdMap;
|
||||
import com.seibel.distanthorizons.core.dataObjects.transformers.LodDataBuilder;
|
||||
import com.seibel.distanthorizons.core.file.IDataSource;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtilV2;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtilV1;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.RenderDataPointUtil;
|
||||
@@ -47,10 +47,10 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
* TODO create a child object that extends AutoClosable
|
||||
* that can be pooled to reduce GC overhead
|
||||
*
|
||||
* @see FullDataPointUtil
|
||||
* @see FullDataPointUtilV2
|
||||
* @see FullDataSourceV1
|
||||
*/
|
||||
public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
public class FullDataSourceV2 implements IDataSource<IDhLevel>
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
/** useful for debugging, but can slow down update operations quite a bit due to being called so often. */
|
||||
@@ -100,8 +100,8 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
// constructors //
|
||||
//==============//
|
||||
|
||||
public static NewFullDataSource createEmpty(DhSectionPos pos) { return new NewFullDataSource(pos); }
|
||||
private NewFullDataSource(DhSectionPos pos)
|
||||
public static FullDataSourceV2 createEmpty(DhSectionPos pos) { return new FullDataSourceV2(pos); }
|
||||
private FullDataSourceV2(DhSectionPos pos)
|
||||
{
|
||||
this.pos = pos;
|
||||
this.dataPoints = new long[WIDTH * WIDTH][];
|
||||
@@ -113,8 +113,8 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
this.columnGenerationSteps = new byte[WIDTH * WIDTH];
|
||||
}
|
||||
|
||||
public static NewFullDataSource createWithData(DhSectionPos pos, FullDataPointIdMap mapping, long[][] data, byte[] columnGenerationStep) { return new NewFullDataSource(pos, mapping, data, columnGenerationStep); }
|
||||
private NewFullDataSource(DhSectionPos pos, FullDataPointIdMap mapping, long[][] data, byte[] columnGenerationSteps)
|
||||
public static FullDataSourceV2 createWithData(DhSectionPos pos, FullDataPointIdMap mapping, long[][] data, byte[] columnGenerationStep) { return new FullDataSourceV2(pos, mapping, data, columnGenerationStep); }
|
||||
private FullDataSourceV2(DhSectionPos pos, FullDataPointIdMap mapping, long[][] data, byte[] columnGenerationSteps)
|
||||
{
|
||||
LodUtil.assertTrue(data.length == WIDTH * WIDTH);
|
||||
|
||||
@@ -126,16 +126,16 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
this.columnGenerationSteps = columnGenerationSteps;
|
||||
}
|
||||
|
||||
public static NewFullDataSource createFromChunk(IChunkWrapper chunkWrapper) { return LodDataBuilder.createGeneratedDataSource(chunkWrapper); }
|
||||
public static FullDataSourceV2 createFromChunk(IChunkWrapper chunkWrapper) { return LodDataBuilder.createGeneratedDataSource(chunkWrapper); }
|
||||
|
||||
public static NewFullDataSource createFromCompleteDataSource(FullDataSourceV1 legacyData)
|
||||
public static FullDataSourceV2 createFromCompleteDataSource(FullDataSourceV1 legacyData)
|
||||
{
|
||||
if (FullDataSourceV1.WIDTH != WIDTH)
|
||||
{
|
||||
throw new UnsupportedOperationException(
|
||||
"Unable to convert CompleteFullDataSource into NewFullDataSource. " +
|
||||
"Unable to convert ["+FullDataSourceV1.class.getSimpleName()+"] into ["+FullDataSourceV2.class.getSimpleName()+"]. " +
|
||||
"Data sources have different data point widths and no converter is present. " +
|
||||
"CompleteFullDataSource width ["+ FullDataSourceV1.WIDTH+"], NewFullDataSource width ["+WIDTH+"].");
|
||||
"input width ["+ FullDataSourceV1.WIDTH+"], recipient width ["+WIDTH+"].");
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
blockLight = 0;
|
||||
}
|
||||
|
||||
long newDataPoint = FullDataPointUtil.encode(id, height, bottomY, blockLight, skyLight);
|
||||
long newDataPoint = FullDataPointUtilV2.encode(id, height, bottomY, blockLight, skyLight);
|
||||
dataColumn[i] = newDataPoint;
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
}
|
||||
}
|
||||
|
||||
NewFullDataSource newFullDataSource = NewFullDataSource.createWithData(legacyData.getSectionPos(), legacyData.mapping, dataPoints, columnGenerationSteps);
|
||||
FullDataSourceV2 fullDataSource = FullDataSourceV2.createWithData(legacyData.getSectionPos(), legacyData.mapping, dataPoints, columnGenerationSteps);
|
||||
|
||||
|
||||
// should only be used if debugging, this is a very expensive operation
|
||||
@@ -213,7 +213,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
long[] legacyDataColumn = legacyData.get(x, z);
|
||||
if (legacyDataColumn != null && legacyDataColumn.length != 0)
|
||||
{
|
||||
long[] newDataColumn = newFullDataSource.get(x, z);
|
||||
long[] newDataColumn = fullDataSource.get(x, z);
|
||||
|
||||
if (newDataColumn == null)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
}
|
||||
}
|
||||
|
||||
return newFullDataSource;
|
||||
return fullDataSource;
|
||||
}
|
||||
|
||||
|
||||
@@ -251,8 +251,8 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
public long[] get(int relX, int relZ) throws IndexOutOfBoundsException { return this.dataPoints[relativePosToIndex(relX, relZ)]; }
|
||||
|
||||
@Override
|
||||
public boolean update(NewFullDataSource inputDataSource, @Nullable IDhLevel level) { return this.update(inputDataSource); }
|
||||
public boolean update(NewFullDataSource inputDataSource)
|
||||
public boolean update(FullDataSourceV2 inputDataSource, @Nullable IDhLevel level) { return this.update(inputDataSource); }
|
||||
public boolean update(FullDataSourceV2 inputDataSource)
|
||||
{
|
||||
// shouldn't happen, but James saw it happen once
|
||||
if (inputDataSource.mapping.getMaxValidId() == 0)
|
||||
@@ -288,7 +288,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
throw new UnsupportedOperationException("Unsupported data source update. Expected input detail level of ["+thisDetailLevel+"] or ["+(thisDetailLevel+1)+"], received detail level ["+inputDetailLevel+"].");
|
||||
}
|
||||
|
||||
if (dataChanged && this.pos.getDetailLevel() < NewFullDataFileHandler.TOP_SECTION_DETAIL_LEVEL)
|
||||
if (dataChanged && this.pos.getDetailLevel() < FullDataFileHandlerV2.TOP_SECTION_DETAIL_LEVEL)
|
||||
{
|
||||
// mark that this data source should be applied to its parent
|
||||
this.applyToParent = true;
|
||||
@@ -302,7 +302,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
|
||||
return dataChanged;
|
||||
}
|
||||
public boolean updateFromSameDetailLevel(NewFullDataSource inputDataSource, int[] remappedIds)
|
||||
public boolean updateFromSameDetailLevel(FullDataSourceV2 inputDataSource, int[] remappedIds)
|
||||
{
|
||||
// both data sources should have the same detail level
|
||||
if (inputDataSource.pos.getDetailLevel() != this.pos.getDetailLevel())
|
||||
@@ -351,7 +351,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
|
||||
return dataChanged;
|
||||
}
|
||||
public boolean updateFromOneBelowDetailLevel(NewFullDataSource inputDataSource, int[] remappedIds)
|
||||
public boolean updateFromOneBelowDetailLevel(FullDataSourceV2 inputDataSource, int[] remappedIds)
|
||||
{
|
||||
if (inputDataSource.pos.getDetailLevel() + 1 != this.pos.getDetailLevel())
|
||||
{
|
||||
@@ -406,7 +406,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
|
||||
return dataChanged;
|
||||
}
|
||||
private static long[] mergeInputTwoByTwoDataColumn(NewFullDataSource inputDataSource, int x, int z)
|
||||
private static long[] mergeInputTwoByTwoDataColumn(FullDataSourceV2 inputDataSource, int x, int z)
|
||||
{
|
||||
ArrayList<Long> newColumnList = new ArrayList<>();
|
||||
|
||||
@@ -460,8 +460,8 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
}
|
||||
long datapoint = inputDataArray[dataPointIndex];
|
||||
|
||||
int datapointMinY = FullDataPointUtil.getBottomY(datapoint);
|
||||
int numbOfBlocksTall = FullDataPointUtil.getHeight(datapoint);
|
||||
int datapointMinY = FullDataPointUtilV2.getBottomY(datapoint);
|
||||
int numbOfBlocksTall = FullDataPointUtilV2.getHeight(datapoint);
|
||||
int datapointMaxY = (datapointMinY + numbOfBlocksTall);
|
||||
|
||||
|
||||
@@ -504,9 +504,9 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
int[] mergeSkyLights = new int[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
mergeIds[i] = FullDataPointUtil.getId(datapointsForYSlice[i]);
|
||||
mergeBlockLights[i] = FullDataPointUtil.getBlockLight(datapointsForYSlice[i]);
|
||||
mergeSkyLights[i] = FullDataPointUtil.getSkyLight(datapointsForYSlice[i]);
|
||||
mergeIds[i] = FullDataPointUtilV2.getId(datapointsForYSlice[i]);
|
||||
mergeBlockLights[i] = FullDataPointUtilV2.getBlockLight(datapointsForYSlice[i]);
|
||||
mergeSkyLights[i] = FullDataPointUtilV2.getSkyLight(datapointsForYSlice[i]);
|
||||
}
|
||||
|
||||
|
||||
@@ -523,7 +523,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
{
|
||||
if (height != 0)
|
||||
{
|
||||
newColumnList.add(FullDataPointUtil.encode(lastId, height, minY, lastBlockLight, lastSkyLight));
|
||||
newColumnList.add(FullDataPointUtilV2.encode(lastId, height, minY, lastBlockLight, lastSkyLight));
|
||||
}
|
||||
|
||||
lastId = id;
|
||||
@@ -537,7 +537,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
// add the last slice if present
|
||||
if (height != 0)
|
||||
{
|
||||
newColumnList.add(FullDataPointUtil.encode(lastId, height, minY, lastBlockLight, lastSkyLight));
|
||||
newColumnList.add(FullDataPointUtilV2.encode(lastId, height, minY, lastBlockLight, lastSkyLight));
|
||||
}
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
long[] dataColumn = this.dataPoints[dataPointIndex];
|
||||
for (int i = 0; i < dataColumn.length; i++)
|
||||
{
|
||||
dataColumn[i] = FullDataPointUtil.remap(remappedIds, dataColumn[i]);
|
||||
dataColumn[i] = FullDataPointUtilV2.remap(remappedIds, dataColumn[i]);
|
||||
}
|
||||
}
|
||||
private static boolean areDataColumnsDifferent(long[] oldDataArray, long[] newDataArray)
|
||||
@@ -705,7 +705,7 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
for (int i = 0; i < longArray.length; i++)
|
||||
{
|
||||
long dataPoint = longArray[i];
|
||||
int id = FullDataPointUtil.getId(dataPoint);
|
||||
int id = FullDataPointUtilV2.getId(dataPoint);
|
||||
if (id > maxValidId)
|
||||
{
|
||||
LodUtil.assertNotReach("Column set with higher than possible ID. ID [" + id + "], max valid ID [" + maxValidId + "].");
|
||||
@@ -738,11 +738,11 @@ public class NewFullDataSource implements IDataSource<IDhLevel>
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (!(obj instanceof NewFullDataSource))
|
||||
if (!(obj instanceof FullDataSourceV2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
NewFullDataSource other = (NewFullDataSource) obj;
|
||||
FullDataSourceV2 other = (FullDataSourceV2) obj;
|
||||
|
||||
if (!other.pos.equals(this.pos))
|
||||
{
|
||||
+4
-4
@@ -20,7 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.dataObjects.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dataObjects.transformers.FullDataToRenderDataTransformer;
|
||||
import com.seibel.distanthorizons.core.file.IDataSource;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
@@ -289,7 +289,7 @@ public class ColumnRenderSource implements IDataSource<IDhClientLevel>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(NewFullDataSource inputFullDataSource, IDhClientLevel level)
|
||||
public boolean update(FullDataSourceV2 inputFullDataSource, IDhClientLevel level)
|
||||
{
|
||||
final String errorMessagePrefix = "Unable to complete update for RenderSource pos: [" + this.sectionPos + "] and pos: [" + inputFullDataSource.getSectionPos() + "]. Error:";
|
||||
|
||||
@@ -310,9 +310,9 @@ public class ColumnRenderSource implements IDataSource<IDhClientLevel>
|
||||
int halfBlockWidth = inputFullDataSource.getSectionPos().getBlockWidth() / 2;
|
||||
DhBlockPos2D minBlockPos = new DhBlockPos2D(centerBlockPos.x - halfBlockWidth, centerBlockPos.z - halfBlockWidth);
|
||||
|
||||
for (int x = 0; x < NewFullDataSource.WIDTH; x++)
|
||||
for (int x = 0; x < FullDataSourceV2.WIDTH; x++)
|
||||
{
|
||||
for (int z = 0; z < NewFullDataSource.WIDTH; z++)
|
||||
for (int z = 0; z < FullDataSourceV2.WIDTH; z++)
|
||||
{
|
||||
ColumnArrayView columnArrayView = this.getVerticalDataPointView(x, z);
|
||||
int columnHash = columnArrayView.getDataHash();
|
||||
|
||||
+6
-6
@@ -23,7 +23,7 @@ import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
@@ -57,7 +57,7 @@ public class ChunkToLodBuilder implements AutoCloseable
|
||||
// data generation //
|
||||
//=================//
|
||||
|
||||
public CompletableFuture<NewFullDataSource> tryGenerateData(IChunkWrapper chunkWrapper)
|
||||
public CompletableFuture<FullDataSourceV2> tryGenerateData(IChunkWrapper chunkWrapper)
|
||||
{
|
||||
if (chunkWrapper == null)
|
||||
{
|
||||
@@ -74,7 +74,7 @@ public class ChunkToLodBuilder implements AutoCloseable
|
||||
}
|
||||
|
||||
// Otherwise, it means we're the first to do so. Let's submit our task to this entry.
|
||||
CompletableFuture<NewFullDataSource> future = new CompletableFuture<>();
|
||||
CompletableFuture<FullDataSourceV2> future = new CompletableFuture<>();
|
||||
this.concurrentTaskToBuildList.addLast(new Task(chunkWrapper.getChunkPos(), future));
|
||||
return future;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class ChunkToLodBuilder implements AutoCloseable
|
||||
{
|
||||
if (LodDataBuilder.canGenerateLodFromChunk(latestChunk))
|
||||
{
|
||||
NewFullDataSource dataSource = LodDataBuilder.createGeneratedDataSource(latestChunk);
|
||||
FullDataSourceV2 dataSource = LodDataBuilder.createGeneratedDataSource(latestChunk);
|
||||
if (dataSource != null)
|
||||
{
|
||||
task.future.complete(dataSource);
|
||||
@@ -233,11 +233,11 @@ public class ChunkToLodBuilder implements AutoCloseable
|
||||
private static class Task
|
||||
{
|
||||
public final DhChunkPos chunkPos;
|
||||
public final CompletableFuture<NewFullDataSource> future;
|
||||
public final CompletableFuture<FullDataSourceV2> future;
|
||||
/** This is tracked so impossible tasks can be removed from the queue */
|
||||
public long generationAttemptExpirationTimeMs = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(10);
|
||||
|
||||
Task(DhChunkPos chunkPos, CompletableFuture<NewFullDataSource> future)
|
||||
Task(DhChunkPos chunkPos, CompletableFuture<FullDataSourceV2> future)
|
||||
{
|
||||
this.chunkPos = chunkPos;
|
||||
this.future = future;
|
||||
|
||||
+10
-10
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.dataObjects.transformers;
|
||||
import com.seibel.distanthorizons.api.enums.config.EBlocksToAvoid;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.FullDataPointIdMap;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.columnViews.ColumnArrayView;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
@@ -30,7 +30,7 @@ import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtilV2;
|
||||
import com.seibel.distanthorizons.core.util.RenderDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
@@ -41,7 +41,7 @@ import org.apache.logging.log4j.Logger;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Handles converting {@link NewFullDataSource}'s to {@link ColumnRenderSource}.
|
||||
* Handles converting {@link FullDataSourceV2}'s to {@link ColumnRenderSource}.
|
||||
*/
|
||||
public class FullDataToRenderDataTransformer
|
||||
{
|
||||
@@ -56,7 +56,7 @@ public class FullDataToRenderDataTransformer
|
||||
// public transformer interface //
|
||||
//==============================//
|
||||
|
||||
public static ColumnRenderSource transformFullDataToRenderSource(NewFullDataSource fullDataSource, IDhClientLevel level)
|
||||
public static ColumnRenderSource transformFullDataToRenderSource(FullDataSourceV2 fullDataSource, IDhClientLevel level)
|
||||
{
|
||||
if (fullDataSource == null)
|
||||
{
|
||||
@@ -92,7 +92,7 @@ public class FullDataToRenderDataTransformer
|
||||
* @throws InterruptedException Can be caused by interrupting the thread upstream.
|
||||
* Generally thrown if the method is running after the client leaves the current world.
|
||||
*/
|
||||
private static ColumnRenderSource transformCompleteFullDataToColumnData(IDhClientLevel level, NewFullDataSource fullDataSource) throws InterruptedException
|
||||
private static ColumnRenderSource transformCompleteFullDataToColumnData(IDhClientLevel level, FullDataSourceV2 fullDataSource) throws InterruptedException
|
||||
{
|
||||
final DhSectionPos pos = fullDataSource.getSectionPos();
|
||||
final byte dataDetail = fullDataSource.getDataDetailLevel();
|
||||
@@ -174,11 +174,11 @@ public class FullDataToRenderDataTransformer
|
||||
for (int i = 0; i < fullColumnData.length; i++)
|
||||
{
|
||||
long fullData = fullColumnData[i];
|
||||
int bottomY = FullDataPointUtil.getBottomY(fullData);
|
||||
int blockHeight = FullDataPointUtil.getHeight(fullData);
|
||||
int id = FullDataPointUtil.getId(fullData);
|
||||
int blockLight = FullDataPointUtil.getBlockLight(fullData);
|
||||
int skyLight = FullDataPointUtil.getSkyLight(fullData);
|
||||
int bottomY = FullDataPointUtilV2.getBottomY(fullData);
|
||||
int blockHeight = FullDataPointUtilV2.getHeight(fullData);
|
||||
int id = FullDataPointUtilV2.getId(fullData);
|
||||
int blockLight = FullDataPointUtilV2.getBlockLight(fullData);
|
||||
int skyLight = FullDataPointUtilV2.getSkyLight(fullData);
|
||||
|
||||
// TODO how should corrupted data be handled?
|
||||
// TODO why is the full data corrupted in the first place? FullDataPointUtil hasn't been changed in a long time, could one of the full data point objects be corrupted?
|
||||
|
||||
+11
-11
@@ -24,12 +24,12 @@ import java.util.List;
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.distanthorizons.api.objects.data.DhApiChunk;
|
||||
import com.seibel.distanthorizons.api.objects.data.DhApiTerrainDataPoint;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtilV2;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
@@ -42,8 +42,8 @@ public class LodDataBuilder
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
private static final IBlockStateWrapper AIR = SingletonInjector.INSTANCE.get(IWrapperFactory.class).getAirBlockStateWrapper();
|
||||
/** how many chunks wide the {@link NewFullDataSource} is. */
|
||||
private static final int NUMB_OF_CHUNKS_WIDE = NewFullDataSource.WIDTH / LodUtil.CHUNK_WIDTH;
|
||||
/** how many chunks wide the {@link FullDataSourceV2} is. */
|
||||
private static final int NUMB_OF_CHUNKS_WIDE = FullDataSourceV2.WIDTH / LodUtil.CHUNK_WIDTH;
|
||||
|
||||
private static boolean getTopErrorLogged = false;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class LodDataBuilder
|
||||
// converters //
|
||||
//============//
|
||||
|
||||
public static NewFullDataSource createGeneratedDataSource(IChunkWrapper chunkWrapper)
|
||||
public static FullDataSourceV2 createGeneratedDataSource(IChunkWrapper chunkWrapper)
|
||||
{
|
||||
if (!canGenerateLodFromChunk(chunkWrapper))
|
||||
{
|
||||
@@ -70,7 +70,7 @@ public class LodDataBuilder
|
||||
sectionPosZ = (sectionPosZ < 0) ? ((sectionPosZ + 1) / NUMB_OF_CHUNKS_WIDE) - 1 : (sectionPosZ / NUMB_OF_CHUNKS_WIDE);
|
||||
DhSectionPos pos = new DhSectionPos(DhSectionPos.SECTION_BLOCK_DETAIL_LEVEL, sectionPosX, sectionPosZ);
|
||||
|
||||
NewFullDataSource dataSource = NewFullDataSource.createEmpty(pos);
|
||||
FullDataSourceV2 dataSource = FullDataSourceV2.createEmpty(pos);
|
||||
dataSource.markNotEmpty();
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class LodDataBuilder
|
||||
|
||||
if (!newBiome.equals(biome) || !newBlockState.equals(blockState))
|
||||
{
|
||||
longs.add(FullDataPointUtil.encode(mappedId, lastY - y, y + 1 - chunkWrapper.getMinBuildHeight(), blockLight, skyLight));
|
||||
longs.add(FullDataPointUtilV2.encode(mappedId, lastY - y, y + 1 - chunkWrapper.getMinBuildHeight(), blockLight, skyLight));
|
||||
biome = newBiome;
|
||||
blockState = newBlockState;
|
||||
mappedId = dataSource.getMapping().addIfNotPresentAndGetId(biome, blockState);
|
||||
@@ -186,7 +186,7 @@ public class LodDataBuilder
|
||||
lastY = y;
|
||||
}
|
||||
}
|
||||
longs.add(FullDataPointUtil.encode(mappedId, lastY - y, y + 1 - chunkWrapper.getMinBuildHeight(), blockLight, skyLight));
|
||||
longs.add(FullDataPointUtilV2.encode(mappedId, lastY - y, y + 1 - chunkWrapper.getMinBuildHeight(), blockLight, skyLight));
|
||||
|
||||
// reverse the array so index 0 is the lowest,
|
||||
// this is necessary for later logic
|
||||
@@ -211,9 +211,9 @@ public class LodDataBuilder
|
||||
|
||||
|
||||
/** @throws ClassCastException if an API user returns the wrong object type(s) */
|
||||
public static NewFullDataSource createFromApiChunkData(DhApiChunk dataPoints) throws ClassCastException
|
||||
public static FullDataSourceV2 createFromApiChunkData(DhApiChunk dataPoints) throws ClassCastException
|
||||
{
|
||||
NewFullDataSource accessor = NewFullDataSource.createEmpty(new DhSectionPos(new DhChunkPos(dataPoints.chunkPosX, dataPoints.chunkPosZ)));
|
||||
FullDataSourceV2 accessor = FullDataSourceV2.createEmpty(new DhSectionPos(new DhChunkPos(dataPoints.chunkPosX, dataPoints.chunkPosZ)));
|
||||
for (int relZ = 0; relZ < LodUtil.CHUNK_WIDTH; relZ++)
|
||||
{
|
||||
for (int relX = 0; relX < LodUtil.CHUNK_WIDTH; relX++)
|
||||
@@ -237,7 +237,7 @@ public class LodDataBuilder
|
||||
(IBlockStateWrapper) (dataPoint.blockStateWrapper)
|
||||
);
|
||||
|
||||
packedDataPoints[index] = FullDataPointUtil.encode(
|
||||
packedDataPoints[index] = FullDataPointUtilV2.encode(
|
||||
id,
|
||||
dataPoint.topYBlockPos - dataPoint.bottomYBlockPos,
|
||||
dataPoint.bottomYBlockPos - dataPoints.topYBlockPos,
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.seibel.distanthorizons.core.file;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSource;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
@@ -190,7 +190,7 @@ public abstract class AbstractLegacyDataSourceHandler<TDataSource extends IDataS
|
||||
//===============//
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateDataSourceAsync(NewFullDataSource inputDataSource)
|
||||
public CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 inputDataSource)
|
||||
{
|
||||
ThreadPoolExecutor executor = ThreadPoolUtil.getFileHandlerExecutor();
|
||||
if (executor == null || executor.isTerminated())
|
||||
@@ -218,7 +218,7 @@ public abstract class AbstractLegacyDataSourceHandler<TDataSource extends IDataS
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
}
|
||||
protected void updateDataSourceAtPos(DhSectionPos pos, NewFullDataSource newDataSource)
|
||||
protected void updateDataSourceAtPos(DhSectionPos pos, FullDataSourceV2 newDataSource)
|
||||
{
|
||||
// a lock is necessary to prevent two threads from writing to the same position at once,
|
||||
// if that happens only the second update will apply and the LOD will end up with hole(s)
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.core.file;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
@@ -161,7 +161,7 @@ public abstract class AbstractNewDataSourceHandler
|
||||
//===============//
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateDataSourceAsync(NewFullDataSource inputDataSource)
|
||||
public CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 inputDataSource)
|
||||
{
|
||||
ThreadPoolExecutor executor = ThreadPoolUtil.getUpdatePropagatorExecutor();
|
||||
if (executor == null || executor.isTerminated())
|
||||
@@ -202,7 +202,7 @@ public abstract class AbstractNewDataSourceHandler
|
||||
* After this method returns the inputData will be written to file.
|
||||
* @param updatePos the position to update
|
||||
*/
|
||||
protected void updateDataSourceAtPos(DhSectionPos updatePos, NewFullDataSource inputData, boolean lockOnUpdatePos)
|
||||
protected void updateDataSourceAtPos(DhSectionPos updatePos, FullDataSourceV2 inputData, boolean lockOnUpdatePos)
|
||||
{
|
||||
boolean methodLocked = false;
|
||||
// a lock is necessary to prevent two threads from writing to the same position at once,
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.seibel.distanthorizons.core.file;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.EDhApiDetailLevel;
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.IBaseDTO;
|
||||
@@ -26,7 +26,7 @@ public interface IDataSource<TDhLevel extends IDhLevel> extends IBaseDTO<DhSecti
|
||||
//===============//
|
||||
|
||||
/** @return true if the data was changed */
|
||||
boolean update(NewFullDataSource chunkData, TDhLevel level);
|
||||
boolean update(FullDataSourceV2 chunkData, TDhLevel level);
|
||||
|
||||
// still used by RenderSource, remove once that's been changed
|
||||
@Deprecated
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.core.file;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.IFullDataSourceProvider;
|
||||
import com.seibel.distanthorizons.core.file.renderfile.IRenderSourceProvider;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
@@ -18,6 +18,6 @@ public interface ISourceProvider<TDataSource extends IDataSource<TDhLevel>, TDhL
|
||||
{
|
||||
CompletableFuture<TDataSource> getAsync(DhSectionPos pos);
|
||||
|
||||
CompletableFuture<Void> updateDataSourceAsync(NewFullDataSource inputData);
|
||||
CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 inputData);
|
||||
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,6 +1,6 @@
|
||||
package com.seibel.distanthorizons.core.file.fullDatafile;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.TimerUtil;
|
||||
@@ -22,7 +22,7 @@ public class DelayedFullDataSourceSaveCache
|
||||
private static final Timer DELAY_UPDATE_TIMER = TimerUtil.CreateTimer("Delayed Full Datasource Save Timer");
|
||||
|
||||
|
||||
public final ConcurrentHashMap<DhSectionPos, NewFullDataSource> dataSourceByPosition = new ConcurrentHashMap<>();
|
||||
public final ConcurrentHashMap<DhSectionPos, FullDataSourceV2> dataSourceByPosition = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<DhSectionPos, TimerTask> saveTimerTasksBySectionPos = new ConcurrentHashMap<>();
|
||||
|
||||
private final ISaveDataSourceFunc onSaveTimeoutFunc;
|
||||
@@ -46,14 +46,14 @@ public class DelayedFullDataSourceSaveCache
|
||||
// update queue //
|
||||
//==============//
|
||||
|
||||
public void queueDataSourceForUpdateAndSave(NewFullDataSource inputDataSource)
|
||||
public void queueDataSourceForUpdateAndSave(FullDataSourceV2 inputDataSource)
|
||||
{
|
||||
DhSectionPos dataSourcePos = inputDataSource.getSectionPos();
|
||||
this.dataSourceByPosition.compute(dataSourcePos, (inputPos, temporaryDataSource) ->
|
||||
{
|
||||
if (temporaryDataSource == null)
|
||||
{
|
||||
temporaryDataSource = NewFullDataSource.createEmpty(inputPos);
|
||||
temporaryDataSource = FullDataSourceV2.createEmpty(inputPos);
|
||||
}
|
||||
temporaryDataSource.update(inputDataSource);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class DelayedFullDataSourceSaveCache
|
||||
|
||||
try
|
||||
{
|
||||
NewFullDataSource dataSourceToSave = DelayedFullDataSourceSaveCache.this.dataSourceByPosition.remove(dataSourcePos);
|
||||
FullDataSourceV2 dataSourceToSave = DelayedFullDataSourceSaveCache.this.dataSourceByPosition.remove(dataSourcePos);
|
||||
if (dataSourceToSave != null)
|
||||
{
|
||||
DelayedFullDataSourceSaveCache.this.onSaveTimeoutFunc.save(dataSourceToSave);
|
||||
@@ -115,7 +115,7 @@ public class DelayedFullDataSourceSaveCache
|
||||
public interface ISaveDataSourceFunc
|
||||
{
|
||||
/** called after the timeout expires */
|
||||
void save(NewFullDataSource inputDataSource);
|
||||
void save(FullDataSourceV2 inputDataSource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+17
-17
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.file.fullDatafile;
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV1;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.file.AbstractNewDataSourceHandler;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
@@ -30,8 +30,8 @@ import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
import com.seibel.distanthorizons.core.render.renderer.IDebugRenderable;
|
||||
import com.seibel.distanthorizons.core.sql.dto.NewFullDataSourceDTO;
|
||||
import com.seibel.distanthorizons.core.sql.repo.NewFullDataSourceRepo;
|
||||
import com.seibel.distanthorizons.core.sql.dto.FullDataSourceV2DTO;
|
||||
import com.seibel.distanthorizons.core.sql.repo.FullDataSourceV2Repo;
|
||||
import com.seibel.distanthorizons.core.util.ThreadUtil;
|
||||
import com.seibel.distanthorizons.core.util.threading.ThreadPoolUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -46,8 +46,8 @@ import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
public class NewFullDataFileHandler
|
||||
extends AbstractNewDataSourceHandler<NewFullDataSource, NewFullDataSourceDTO, NewFullDataSourceRepo, IDhLevel>
|
||||
public class FullDataFileHandlerV2
|
||||
extends AbstractNewDataSourceHandler<FullDataSourceV2, FullDataSourceV2DTO, FullDataSourceV2Repo, IDhLevel>
|
||||
implements IFullDataSourceProvider, IDebugRenderable
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
@@ -93,8 +93,8 @@ public class NewFullDataFileHandler
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public NewFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure) { this(level, saveStructure, null); }
|
||||
public NewFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure, @Nullable File saveDirOverride)
|
||||
public FullDataFileHandlerV2(IDhLevel level, AbstractSaveStructure saveStructure) { this(level, saveStructure, null); }
|
||||
public FullDataFileHandlerV2(IDhLevel level, AbstractSaveStructure saveStructure, @Nullable File saveDirOverride)
|
||||
{
|
||||
super(level, saveStructure, saveDirOverride);
|
||||
this.legacyFileHandler = new FullDataFileHandlerV1(level, saveStructure, saveDirOverride);
|
||||
@@ -120,11 +120,11 @@ public class NewFullDataFileHandler
|
||||
//====================//
|
||||
|
||||
@Override
|
||||
protected NewFullDataSourceRepo createRepo()
|
||||
protected FullDataSourceV2Repo createRepo()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new NewFullDataSourceRepo("jdbc:sqlite", this.saveDir.getPath() + "/" + AbstractSaveStructure.DATABASE_NAME);
|
||||
return new FullDataSourceV2Repo("jdbc:sqlite", this.saveDir.getPath() + "/" + AbstractSaveStructure.DATABASE_NAME);
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@@ -135,13 +135,13 @@ public class NewFullDataFileHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NewFullDataSourceDTO createDtoFromDataSource(NewFullDataSource dataSource)
|
||||
protected FullDataSourceV2DTO createDtoFromDataSource(FullDataSourceV2 dataSource)
|
||||
{
|
||||
try
|
||||
{
|
||||
// when creating new data use the compressor currently selected in the config
|
||||
EDhApiDataCompressionMode compressionModeEnum = Config.Client.Advanced.LodBuilding.dataCompression.get();
|
||||
return NewFullDataSourceDTO.CreateFromDataSource(dataSource, compressionModeEnum);
|
||||
return FullDataSourceV2DTO.CreateFromDataSource(dataSource, compressionModeEnum);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@@ -151,17 +151,17 @@ public class NewFullDataFileHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NewFullDataSource createDataSourceFromDto(NewFullDataSourceDTO dto) throws InterruptedException, IOException
|
||||
protected FullDataSourceV2 createDataSourceFromDto(FullDataSourceV2DTO dto) throws InterruptedException, IOException
|
||||
{ return dto.createDataSource(this.level.getLevelWrapper()); }
|
||||
@Override
|
||||
protected NewFullDataSource createNewDataSourceFromExistingDtos(DhSectionPos pos)
|
||||
protected FullDataSourceV2 createNewDataSourceFromExistingDtos(DhSectionPos pos)
|
||||
{
|
||||
// TODO maybe just set children update flags to true?
|
||||
return NewFullDataSource.createEmpty(pos);
|
||||
return FullDataSourceV2.createEmpty(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NewFullDataSource makeEmptyDataSource(DhSectionPos pos) { return NewFullDataSource.createEmpty(pos); }
|
||||
protected FullDataSourceV2 makeEmptyDataSource(DhSectionPos pos) { return FullDataSourceV2.createEmpty(pos); }
|
||||
|
||||
@Override
|
||||
public boolean canQueueRetrieval()
|
||||
@@ -253,7 +253,7 @@ public class NewFullDataFileHandler
|
||||
childReadLock.lock();
|
||||
this.lockedPosSet.add(childPos);
|
||||
|
||||
NewFullDataSource dataSource = this.get(childPos);
|
||||
FullDataSourceV2 dataSource = this.get(childPos);
|
||||
this.updateDataSourceAtPos(parentUpdatePos, dataSource, false);
|
||||
this.repo.setApplyToParent(childPos, false);
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class NewFullDataFileHandler
|
||||
{
|
||||
// convert the legacy data source to the new format,
|
||||
// this is a relatively cheap operation
|
||||
NewFullDataSource newDataSource = NewFullDataSource.createFromCompleteDataSource(legacyDataSource);
|
||||
FullDataSourceV2 newDataSource = FullDataSourceV2.createFromCompleteDataSource(legacyDataSource);
|
||||
newDataSource.applyToParent = true;
|
||||
|
||||
// the actual update process can be moderately expensive due to having to update
|
||||
+10
-10
@@ -21,7 +21,7 @@ package com.seibel.distanthorizons.core.file.fullDatafile;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.generation.IWorldGenerationQueue;
|
||||
import com.seibel.distanthorizons.core.generation.tasks.IWorldGenTaskTracker;
|
||||
@@ -43,7 +43,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class NewGeneratedFullDataFileHandler extends NewFullDataFileHandler implements IDebugRenderable
|
||||
public class GeneratedFullDataFileHandler extends FullDataFileHandlerV2 implements IDebugRenderable
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
@@ -61,7 +61,7 @@ public class NewGeneratedFullDataFileHandler extends NewFullDataFileHandler impl
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public NewGeneratedFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure) { super(level, saveStructure); }
|
||||
public GeneratedFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure) { super(level, saveStructure); }
|
||||
|
||||
|
||||
|
||||
@@ -248,11 +248,11 @@ public class NewGeneratedFullDataFileHandler extends NewFullDataFileHandler impl
|
||||
|
||||
EDhApiWorldGenerationStep currentMinWorldGenStep = EDhApiWorldGenerationStep.LIGHT;
|
||||
checkWorldGenLoop:
|
||||
for (int x = 0; x < NewFullDataSource.WIDTH; x++)
|
||||
for (int x = 0; x < FullDataSourceV2.WIDTH; x++)
|
||||
{
|
||||
for (int z = 0; z < NewFullDataSource.WIDTH; z++)
|
||||
for (int z = 0; z < FullDataSourceV2.WIDTH; z++)
|
||||
{
|
||||
int index = NewFullDataSource.relativePosToIndex(x, z);
|
||||
int index = FullDataSourceV2.relativePosToIndex(x, z);
|
||||
byte genStepValue = columnGenerationSteps[index];
|
||||
|
||||
if (genStepValue < currentMinWorldGenStep.value)
|
||||
@@ -338,16 +338,16 @@ public class NewGeneratedFullDataFileHandler extends NewFullDataFileHandler impl
|
||||
public boolean isMemoryAddressValid() { return true; }
|
||||
|
||||
@Override
|
||||
public Consumer<NewFullDataSource> getChunkDataConsumer()
|
||||
public Consumer<FullDataSourceV2> getChunkDataConsumer()
|
||||
{
|
||||
return (chunkSizedFullDataSource) ->
|
||||
{
|
||||
NewGeneratedFullDataFileHandler.this.delayedFullDataSourceSaveCache.queueDataSourceForUpdateAndSave(chunkSizedFullDataSource);
|
||||
GeneratedFullDataFileHandler.this.delayedFullDataSourceSaveCache.queueDataSourceForUpdateAndSave(chunkSizedFullDataSource);
|
||||
};
|
||||
}
|
||||
}
|
||||
private void onDataSourceSave(NewFullDataSource fullDataSource)
|
||||
{ NewGeneratedFullDataFileHandler.this.updateDataSourceAsync(fullDataSource); }
|
||||
private void onDataSourceSave(FullDataSourceV2 fullDataSource)
|
||||
{ GeneratedFullDataFileHandler.this.updateDataSourceAsync(fullDataSource); }
|
||||
|
||||
|
||||
|
||||
+7
-7
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.file.fullDatafile;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.ISourceProvider;
|
||||
import com.seibel.distanthorizons.core.level.IDhLevel;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
@@ -30,15 +30,15 @@ import java.util.ArrayList;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* Handles reading, writing, and updating {@link NewFullDataSource}'s. <br>
|
||||
* Handles reading, writing, and updating {@link FullDataSourceV2}'s. <br>
|
||||
* Should be backed by a database handled by a {@link LegacyFullDataRepo}.
|
||||
*/
|
||||
public interface IFullDataSourceProvider extends ISourceProvider<NewFullDataSource, IDhLevel>, AutoCloseable
|
||||
public interface IFullDataSourceProvider extends ISourceProvider<FullDataSourceV2, IDhLevel>, AutoCloseable
|
||||
{
|
||||
CompletableFuture<NewFullDataSource> getAsync(DhSectionPos pos);
|
||||
NewFullDataSource get(DhSectionPos pos);
|
||||
CompletableFuture<FullDataSourceV2> getAsync(DhSectionPos pos);
|
||||
FullDataSourceV2 get(DhSectionPos pos);
|
||||
|
||||
CompletableFuture<Void> updateDataSourceAsync(NewFullDataSource chunkData);
|
||||
CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 chunkData);
|
||||
|
||||
/** @return -1 if this provider never has unsaved data sources */
|
||||
default int getUnsavedDataSourceCount() { return -1; }
|
||||
@@ -49,7 +49,7 @@ public interface IFullDataSourceProvider extends ISourceProvider<NewFullDataSour
|
||||
|
||||
/**
|
||||
* If true this {@link IFullDataSourceProvider} can generate or retrieve
|
||||
* {@link NewFullDataSource}'s that aren't currently in the database.
|
||||
* {@link FullDataSourceV2}'s that aren't currently in the database.
|
||||
*/
|
||||
default boolean canRetrieveMissingDataSources() { return false; }
|
||||
|
||||
|
||||
+3
-3
@@ -25,9 +25,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class NewRemoteFullDataFileHandler extends NewFullDataFileHandler
|
||||
public class RemoteFullDataFileHandler extends FullDataFileHandlerV2
|
||||
{
|
||||
public NewRemoteFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure) { super(level, saveStructure); }
|
||||
public NewRemoteFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure, @Nullable File saveDirOverride) { super(level, saveStructure, saveDirOverride); }
|
||||
public RemoteFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure) { super(level, saveStructure); }
|
||||
public RemoteFullDataFileHandler(IDhLevel level, AbstractSaveStructure saveStructure, @Nullable File saveDirOverride) { super(level, saveStructure, saveDirOverride); }
|
||||
|
||||
}
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.file.renderfile;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.ISourceProvider;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
@@ -36,7 +36,7 @@ public interface IRenderSourceProvider extends ISourceProvider<ColumnRenderSourc
|
||||
{
|
||||
CompletableFuture<ColumnRenderSource> getAsync(DhSectionPos pos);
|
||||
|
||||
CompletableFuture<Void> updateDataSourceAsync(NewFullDataSource dataSource);
|
||||
CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 dataSource);
|
||||
|
||||
/** Deletes any data stored in the render cache so it can be re-created */
|
||||
void deleteRenderCache();
|
||||
|
||||
+6
-7
@@ -19,11 +19,11 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.file.renderfile;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dataObjects.render.ColumnRenderSourceLoader;
|
||||
import com.seibel.distanthorizons.core.dataObjects.transformers.FullDataToRenderDataTransformer;
|
||||
import com.seibel.distanthorizons.core.file.AbstractLegacyDataSourceHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
@@ -49,7 +49,7 @@ public class RenderSourceFileHandler extends AbstractLegacyDataSourceHandler<Col
|
||||
private final F3Screen.NestedMessage threadPoolMsg;
|
||||
private int totalRetrievalPositionCount = 0;
|
||||
|
||||
public final IFullDataSourceProvider fullDataSourceProvider;
|
||||
public final IFullDataSourceProvider fullDataSourceProvider; // TODO replace with FullDataFileHandlerV2?
|
||||
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class RenderSourceFileHandler extends AbstractLegacyDataSourceHandler<Col
|
||||
{
|
||||
ColumnRenderSource renderDataSource;
|
||||
|
||||
NewFullDataSource fullDataSource = this.fullDataSourceProvider.get(pos);
|
||||
FullDataSourceV2 fullDataSource = this.fullDataSourceProvider.get(pos);
|
||||
renderDataSource = FullDataToRenderDataTransformer.transformFullDataToRenderSource(fullDataSource, this.level);
|
||||
return renderDataSource;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class RenderSourceFileHandler extends AbstractLegacyDataSourceHandler<Col
|
||||
//=====================//
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateDataSourceAsync(NewFullDataSource inputDataSource)
|
||||
public CompletableFuture<Void> updateDataSourceAsync(FullDataSourceV2 inputDataSource)
|
||||
{
|
||||
// TODO once the legacy data provider has been replaced this can be removed
|
||||
this.updateDataSourceAtPos(inputDataSource.getSectionPos(), inputDataSource);
|
||||
@@ -140,8 +140,7 @@ public class RenderSourceFileHandler extends AbstractLegacyDataSourceHandler<Col
|
||||
lines.add(" Update thread pool tasks: " + updateQueueSize + " (completed: " + updateCompletedTaskSize + ")");
|
||||
lines.add(" Level Unsaved #: " + this.level.getUnsavedDataSourceCount());
|
||||
lines.add(" Full Data Unsaved #: " + this.fullDataSourceProvider.getUnsavedDataSourceCount());
|
||||
//lines.add(" Lock #: " + ((NewFullDataFileHandler) this.fullDataSourceProvider).lockedPosSet.size());
|
||||
lines.add(" Parent Update #: " + ((NewFullDataFileHandler) this.fullDataSourceProvider).parentUpdatingPosSet.size());
|
||||
lines.add(" Parent Update #: " + ((FullDataFileHandlerV2) this.fullDataSourceProvider).parentUpdatingPosSet.size());
|
||||
lines.add(" Unsaved render sources: " + this.unsavedDataSourceBySectionPos.size());
|
||||
|
||||
return lines.toArray(new String[0]);
|
||||
|
||||
+11
-11
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.file.subDimMatching;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.FullDataPointIdMap;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV1;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.file.structure.ClientOnlySaveStructure;
|
||||
import com.seibel.distanthorizons.core.generation.DhLightingEngine;
|
||||
@@ -32,7 +32,7 @@ import com.seibel.distanthorizons.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.dataObjects.transformers.LodDataBuilder;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtil;
|
||||
import com.seibel.distanthorizons.core.util.FullDataPointUtilV2;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import com.seibel.distanthorizons.core.util.ThreadUtil;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
@@ -188,9 +188,9 @@ public class SubDimensionLevelMatcher implements AutoCloseable
|
||||
LOGGER.warn("unable to build lod for chunk:"+newlyLoadedChunk.getChunkPos());
|
||||
return null;
|
||||
}
|
||||
NewFullDataSource newChunkSizedFullDataView = NewFullDataSource.createFromChunk(newlyLoadedChunk);
|
||||
FullDataSourceV2 newChunkSizedFullDataView = FullDataSourceV2.createFromChunk(newlyLoadedChunk);
|
||||
// convert to a data source for easier comparing
|
||||
NewFullDataSource newDataSource = NewFullDataSource.createEmpty(new DhSectionPos(this.playerData.playerBlockPos));
|
||||
FullDataSourceV2 newDataSource = FullDataSourceV2.createEmpty(new DhSectionPos(this.playerData.playerBlockPos));
|
||||
newDataSource.update(newChunkSizedFullDataView);
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ public class SubDimensionLevelMatcher implements AutoCloseable
|
||||
{
|
||||
// get the data source to compare against
|
||||
IDhLevel tempLevel = new DhClientLevel(new ClientOnlySaveStructure(), this.currentClientLevel, testLevelFolder, false);
|
||||
NewFullDataSource testFullDataSource = tempLevel.getFullDataProvider().getAsync(new DhSectionPos(this.playerData.playerBlockPos)).join();
|
||||
FullDataSourceV2 testFullDataSource = tempLevel.getFullDataProvider().getAsync(new DhSectionPos(this.playerData.playerBlockPos)).join();
|
||||
if (testFullDataSource == null)
|
||||
{
|
||||
continue;
|
||||
@@ -250,13 +250,13 @@ public class SubDimensionLevelMatcher implements AutoCloseable
|
||||
long newDataPoint = newColumn[i];
|
||||
long testDataPoint = testColumn[i];
|
||||
|
||||
int newId = FullDataPointUtil.getId(newDataPoint);
|
||||
int testId = FullDataPointUtil.getId(testDataPoint);
|
||||
int newId = FullDataPointUtilV2.getId(newDataPoint);
|
||||
int testId = FullDataPointUtilV2.getId(testDataPoint);
|
||||
|
||||
|
||||
// bottom Y
|
||||
int newBottom = FullDataPointUtil.getBottomY(newDataPoint);
|
||||
int testBottom = FullDataPointUtil.getBottomY(testDataPoint);
|
||||
int newBottom = FullDataPointUtilV2.getBottomY(newDataPoint);
|
||||
int testBottom = FullDataPointUtilV2.getBottomY(testDataPoint);
|
||||
if (newBottom == testBottom)
|
||||
{
|
||||
equalDataPoints++;
|
||||
@@ -264,8 +264,8 @@ public class SubDimensionLevelMatcher implements AutoCloseable
|
||||
totalDataPointCount++;
|
||||
|
||||
// height
|
||||
int newHeight = FullDataPointUtil.getHeight(newDataPoint);
|
||||
int testHeight = FullDataPointUtil.getHeight(testDataPoint);
|
||||
int newHeight = FullDataPointUtilV2.getHeight(newDataPoint);
|
||||
int testHeight = FullDataPointUtilV2.getHeight(testDataPoint);
|
||||
if (newHeight == testHeight)
|
||||
{
|
||||
equalDataPoints++;
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@ import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiDistantGenerat
|
||||
import com.seibel.distanthorizons.api.interfaces.override.worldGenerator.IDhApiWorldGenerator;
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGeneratorReturnType;
|
||||
import com.seibel.distanthorizons.api.objects.data.DhApiChunk;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.generation.tasks.*;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
@@ -429,7 +429,7 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
|
||||
DhChunkPos chunkPosMin,
|
||||
byte granularity,
|
||||
byte targetDataDetail,
|
||||
Consumer<NewFullDataSource> chunkDataConsumer
|
||||
Consumer<FullDataSourceV2> chunkDataConsumer
|
||||
)
|
||||
{
|
||||
EDhApiDistantGeneratorMode generatorMode = Config.Client.Advanced.WorldGenerator.distantGeneratorMode.get();
|
||||
@@ -450,7 +450,7 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
|
||||
try
|
||||
{
|
||||
IChunkWrapper chunk = WRAPPER_FACTORY.createChunkWrapper(generatedObjectArray);
|
||||
NewFullDataSource dataSource = LodDataBuilder.createGeneratedDataSource(chunk);
|
||||
FullDataSourceV2 dataSource = LodDataBuilder.createGeneratedDataSource(chunk);
|
||||
LodUtil.assertTrue(dataSource != null);
|
||||
chunkDataConsumer.accept(dataSource);
|
||||
}
|
||||
@@ -475,7 +475,7 @@ public class WorldGenerationQueue implements IWorldGenerationQueue, IDebugRender
|
||||
{
|
||||
try
|
||||
{
|
||||
NewFullDataSource dataSource = LodDataBuilder.createFromApiChunkData(dataPoints);
|
||||
FullDataSourceV2 dataSource = LodDataBuilder.createFromApiChunkData(dataPoints);
|
||||
chunkDataConsumer.accept(dataSource);
|
||||
}
|
||||
catch (ClassCastException e)
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.generation.tasks;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -32,6 +32,6 @@ public interface IWorldGenTaskTracker
|
||||
/** Returns true if the task hasn't been garbage collected. */
|
||||
boolean isMemoryAddressValid();
|
||||
|
||||
Consumer<NewFullDataSource> getChunkDataConsumer();
|
||||
Consumer<FullDataSourceV2> getChunkDataConsumer();
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.generation.tasks;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -46,13 +46,13 @@ public final class WorldGenTaskGroup
|
||||
this.dataDetail = dataDetail;
|
||||
}
|
||||
|
||||
public void consumeChunkData(NewFullDataSource chunkSizedFullDataView)
|
||||
public void consumeChunkData(FullDataSourceV2 chunkSizedFullDataView)
|
||||
{
|
||||
Iterator<WorldGenTask> tasks = this.worldGenTasks.iterator();
|
||||
while (tasks.hasNext())
|
||||
{
|
||||
WorldGenTask task = tasks.next();
|
||||
Consumer<NewFullDataSource> chunkDataConsumer = task.taskTracker.getChunkDataConsumer();
|
||||
Consumer<FullDataSourceV2> chunkDataConsumer = task.taskTracker.getChunkDataConsumer();
|
||||
if (chunkDataConsumer == null)
|
||||
{
|
||||
tasks.remove();
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.api.methods.events.abstractEvents.DhApiChunkModifiedEvent;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dataObjects.transformers.ChunkToLodBuilder;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.DelayedFullDataSourceSaveCache;
|
||||
import com.seibel.distanthorizons.core.pos.DhChunkPos;
|
||||
@@ -59,7 +59,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
@Override
|
||||
public void updateChunkAsync(IChunkWrapper chunkWrapper)
|
||||
{
|
||||
NewFullDataSource dataSource = NewFullDataSource.createFromChunk(chunkWrapper);
|
||||
FullDataSourceV2 dataSource = FullDataSourceV2.createFromChunk(chunkWrapper);
|
||||
if (dataSource == null)
|
||||
{
|
||||
// This can happen if, among other reasons, a chunk save is superseded by a later event
|
||||
@@ -81,7 +81,7 @@ public abstract class AbstractDhLevel implements IDhLevel
|
||||
this.delayedFullDataSourceSaveCache.queueDataSourceForUpdateAndSave(dataSource);
|
||||
}
|
||||
|
||||
private void onDataSourceSave(NewFullDataSource fullDataSource)
|
||||
private void onDataSourceSave(FullDataSourceV2 fullDataSource)
|
||||
{
|
||||
this.updateDataSourcesAsync(fullDataSource).thenRun(() ->
|
||||
{
|
||||
|
||||
@@ -22,12 +22,11 @@ package com.seibel.distanthorizons.core.level;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDebugRendering;
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.file.AbstractNewDataSourceHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.IFullDataSourceProvider;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.renderfile.IRenderSourceProvider;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.file.renderfile.RenderSourceFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
@@ -47,14 +46,14 @@ import java.io.Closeable;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ClientLevelModule implements Closeable, AbstractNewDataSourceHandler.IDataSourceUpdateFunc<NewFullDataSource>
|
||||
public class ClientLevelModule implements Closeable, AbstractNewDataSourceHandler.IDataSourceUpdateFunc<FullDataSourceV2>
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
|
||||
private final IDhClientLevel parentClientLevel;
|
||||
|
||||
public final NewFullDataFileHandler fullDataSourceProvider;
|
||||
public final FullDataFileHandlerV2 fullDataSourceProvider;
|
||||
public final AtomicReference<ClientRenderState> ClientRenderStateRef = new AtomicReference<>();
|
||||
|
||||
public final F3Screen.NestedMessage f3Message;
|
||||
@@ -210,9 +209,9 @@ public class ClientLevelModule implements Closeable, AbstractNewDataSourceHandle
|
||||
// data handling //
|
||||
//===============//
|
||||
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(NewFullDataSource data) { return this.parentClientLevel.getFullDataProvider().updateDataSourceAsync(data); }
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(FullDataSourceV2 data) { return this.parentClientLevel.getFullDataProvider().updateDataSourceAsync(data); }
|
||||
@Override
|
||||
public void OnDataSourceUpdated(NewFullDataSource updatedFullDataSource)
|
||||
public void OnDataSourceUpdated(FullDataSourceV2 updatedFullDataSource)
|
||||
{
|
||||
// if rendering also update the render sources
|
||||
ClientRenderState ClientRenderState = this.ClientRenderStateRef.get();
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.IFullDataSourceProvider;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewRemoteFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.RemoteFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos;
|
||||
@@ -46,7 +45,7 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
|
||||
public final ClientLevelModule clientside;
|
||||
public final IClientLevelWrapper levelWrapper;
|
||||
public final AbstractSaveStructure saveStructure;
|
||||
public final NewRemoteFullDataFileHandler dataFileHandler;
|
||||
public final RemoteFullDataFileHandler dataFileHandler;
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +58,7 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
|
||||
{
|
||||
this.levelWrapper = clientLevelWrapper;
|
||||
this.saveStructure = saveStructure;
|
||||
this.dataFileHandler = new NewRemoteFullDataFileHandler(this, saveStructure, fullDataSaveDirOverride);
|
||||
this.dataFileHandler = new RemoteFullDataFileHandler(this, saveStructure, fullDataSaveDirOverride);
|
||||
this.clientside = new ClientLevelModule(this);
|
||||
|
||||
if (enableRendering)
|
||||
@@ -119,7 +118,7 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
|
||||
public ILevelWrapper getLevelWrapper() { return levelWrapper; }
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(NewFullDataSource data) { return this.clientside.updateDataSourcesAsync(data); }
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(FullDataSourceV2 data) { return this.clientside.updateDataSourcesAsync(data); }
|
||||
|
||||
@Override
|
||||
public int getMinY() { return levelWrapper.getMinHeight(); }
|
||||
@@ -138,7 +137,7 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
|
||||
//=======================//
|
||||
|
||||
@Override
|
||||
public NewFullDataFileHandler getFullDataProvider() { return this.dataFileHandler; }
|
||||
public FullDataFileHandlerV2 getFullDataProvider() { return this.dataFileHandler; }
|
||||
|
||||
@Override
|
||||
public AbstractSaveStructure getSaveStructure()
|
||||
|
||||
@@ -20,10 +20,9 @@
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.IFullDataSourceProvider;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.render.LodRenderSection;
|
||||
import com.seibel.distanthorizons.core.render.renderer.DebugRenderer;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
@@ -175,7 +174,7 @@ public class DhClientServerLevel extends AbstractDhLevel implements IDhClientLev
|
||||
public ILevelWrapper getLevelWrapper() { return getServerLevelWrapper(); }
|
||||
|
||||
@Override
|
||||
public NewFullDataFileHandler getFullDataProvider() { return this.serverside.dataFileHandler; }
|
||||
public FullDataFileHandlerV2 getFullDataProvider() { return this.serverside.dataFileHandler; }
|
||||
|
||||
@Override
|
||||
public AbstractSaveStructure getSaveStructure()
|
||||
@@ -187,7 +186,7 @@ public class DhClientServerLevel extends AbstractDhLevel implements IDhClientLev
|
||||
public boolean hasSkyLight() { return this.serverLevelWrapper.hasSkyLight(); }
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(NewFullDataSource data) { return this.clientside.updateDataSourcesAsync(data); }
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(FullDataSourceV2 data) { return this.clientside.updateDataSourcesAsync(data); }
|
||||
|
||||
@Override
|
||||
public int getMinY() { return getLevelWrapper().getMinHeight(); }
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.pos.DhBlockPos2D;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
@@ -51,7 +51,7 @@ public class DhServerLevel extends AbstractDhLevel implements IDhServerLevel
|
||||
public void serverTick() { this.chunkToLodBuilder.tick(); }
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(NewFullDataSource data) { return this.getFullDataProvider().updateDataSourceAsync(data); }
|
||||
public CompletableFuture<Void> updateDataSourcesAsync(FullDataSourceV2 data) { return this.getFullDataProvider().updateDataSourceAsync(data); }
|
||||
|
||||
@Override
|
||||
public int getMinY() { return getLevelWrapper().getMinHeight(); }
|
||||
@@ -93,7 +93,7 @@ public class DhServerLevel extends AbstractDhLevel implements IDhServerLevel
|
||||
public ILevelWrapper getLevelWrapper() { return getServerLevelWrapper(); }
|
||||
|
||||
@Override
|
||||
public NewFullDataFileHandler getFullDataProvider() { return this.serverside.dataFileHandler; }
|
||||
public FullDataFileHandlerV2 getFullDataProvider() { return this.serverside.dataFileHandler; }
|
||||
|
||||
@Override
|
||||
public AbstractSaveStructure getSaveStructure()
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.FullDataFileHandlerV2;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.distanthorizons.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
@@ -39,13 +39,13 @@ public interface IDhLevel extends AutoCloseable
|
||||
|
||||
void updateChunkAsync(IChunkWrapper chunk);
|
||||
|
||||
NewFullDataFileHandler getFullDataProvider();
|
||||
FullDataFileHandlerV2 getFullDataProvider();
|
||||
|
||||
AbstractSaveStructure getSaveStructure();
|
||||
|
||||
boolean hasSkyLight();
|
||||
|
||||
CompletableFuture<Void> updateDataSourcesAsync(NewFullDataSource data);
|
||||
CompletableFuture<Void> updateDataSourcesAsync(FullDataSourceV2 data);
|
||||
|
||||
/**
|
||||
* this number is generally related to how many data sources have been updated
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewGeneratedFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.GeneratedFullDataFileHandler;
|
||||
|
||||
public interface IDhWorldGenLevel extends IDhLevel, NewGeneratedFullDataFileHandler.IOnWorldGenCompleteListener
|
||||
public interface IDhWorldGenLevel extends IDhLevel, GeneratedFullDataFileHandler.IOnWorldGenCompleteListener
|
||||
{
|
||||
void doWorldGen();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.seibel.distanthorizons.core.level;
|
||||
import com.seibel.distanthorizons.api.interfaces.override.worldGenerator.IDhApiWorldGenerator;
|
||||
import com.seibel.distanthorizons.core.config.AppliedConfigState;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewGeneratedFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.GeneratedFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.structure.AbstractSaveStructure;
|
||||
import com.seibel.distanthorizons.core.generation.BatchGenerator;
|
||||
import com.seibel.distanthorizons.core.generation.WorldGenerationQueue;
|
||||
@@ -36,7 +36,7 @@ public class ServerLevelModule
|
||||
|
||||
public final IDhServerLevel parentServerLevel;
|
||||
public final AbstractSaveStructure saveStructure;
|
||||
public final NewGeneratedFullDataFileHandler dataFileHandler;
|
||||
public final GeneratedFullDataFileHandler dataFileHandler;
|
||||
public final AppliedConfigState<Boolean> worldGeneratorEnabledConfig;
|
||||
|
||||
public final WorldGenModule worldGenModule;
|
||||
@@ -47,7 +47,7 @@ public class ServerLevelModule
|
||||
{
|
||||
this.parentServerLevel = parentServerLevel;
|
||||
this.saveStructure = saveStructure;
|
||||
this.dataFileHandler = new NewGeneratedFullDataFileHandler(parentServerLevel, saveStructure);
|
||||
this.dataFileHandler = new GeneratedFullDataFileHandler(parentServerLevel, saveStructure);
|
||||
this.worldGeneratorEnabledConfig = new AppliedConfigState<>(Config.Client.Advanced.WorldGenerator.enableDistantGeneration);
|
||||
this.worldGenModule = new WorldGenModule(this.dataFileHandler, this.parentServerLevel);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.level;
|
||||
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.NewGeneratedFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.file.fullDatafile.GeneratedFullDataFileHandler;
|
||||
import com.seibel.distanthorizons.core.generation.IWorldGenerationQueue;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
@@ -34,15 +34,15 @@ public class WorldGenModule implements Closeable
|
||||
{
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
|
||||
private final NewGeneratedFullDataFileHandler dataFileHandler;
|
||||
private final NewGeneratedFullDataFileHandler.IOnWorldGenCompleteListener onWorldGenCompleteListener;
|
||||
private final GeneratedFullDataFileHandler dataFileHandler;
|
||||
private final GeneratedFullDataFileHandler.IOnWorldGenCompleteListener onWorldGenCompleteListener;
|
||||
|
||||
private final AtomicReference<AbstractWorldGenState> worldGenStateRef = new AtomicReference<>();
|
||||
private final F3Screen.DynamicMessage worldGenF3Message;
|
||||
|
||||
|
||||
|
||||
public WorldGenModule(NewGeneratedFullDataFileHandler dataFileHandler, NewGeneratedFullDataFileHandler.IOnWorldGenCompleteListener onWorldGenCompleteListener)
|
||||
public WorldGenModule(GeneratedFullDataFileHandler dataFileHandler, GeneratedFullDataFileHandler.IOnWorldGenCompleteListener onWorldGenCompleteListener)
|
||||
{
|
||||
this.dataFileHandler = dataFileHandler;
|
||||
this.onWorldGenCompleteListener = onWorldGenCompleteListener;
|
||||
@@ -71,7 +71,7 @@ public class WorldGenModule implements Closeable
|
||||
// world gen control //
|
||||
//===================//
|
||||
|
||||
public void startWorldGen(NewGeneratedFullDataFileHandler dataFileHandler, AbstractWorldGenState newWgs)
|
||||
public void startWorldGen(GeneratedFullDataFileHandler dataFileHandler, AbstractWorldGenState newWgs)
|
||||
{
|
||||
// create the new world generator
|
||||
if (!this.worldGenStateRef.compareAndSet(null, newWgs))
|
||||
@@ -83,7 +83,7 @@ public class WorldGenModule implements Closeable
|
||||
dataFileHandler.setWorldGenerationQueue(newWgs.worldGenerationQueue);
|
||||
}
|
||||
|
||||
public void stopWorldGen(NewGeneratedFullDataFileHandler dataFileHandler)
|
||||
public void stopWorldGen(GeneratedFullDataFileHandler dataFileHandler)
|
||||
{
|
||||
AbstractWorldGenState worldGenState = this.worldGenStateRef.get();
|
||||
if (worldGenState == null)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.coreapi.util.BitShiftUtil;
|
||||
import com.seibel.distanthorizons.core.util.LodUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -122,7 +122,7 @@ public class DhLodPos implements Comparable<DhLodPos>
|
||||
public DhLodPos getDhSectionRelativePositionForDetailLevel() throws IllegalArgumentException { return this.getDhSectionRelativePositionForDetailLevel(this.detailLevel); }
|
||||
/**
|
||||
* Returns a DhLodPos with the given detail level and an X/Z position somewhere between (0,0) and (63,63).
|
||||
* This is done to access specific sections from a {@link NewFullDataSource} where LOD columns are stored
|
||||
* This is done to access specific sections from a {@link FullDataSourceV2} where LOD columns are stored
|
||||
* in 64 x 64 blocks.
|
||||
*
|
||||
* @throws IllegalArgumentException if this position's detail level is lower than the output detail level
|
||||
|
||||
+16
-17
@@ -21,9 +21,8 @@ package com.seibel.distanthorizons.core.sql.dto;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.api.enums.worldGeneration.EDhApiWorldGenerationStep;
|
||||
import com.seibel.distanthorizons.core.config.Config;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.FullDataPointIdMap;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.util.objects.dataStreams.DhDataInputStream;
|
||||
import com.seibel.distanthorizons.core.util.objects.dataStreams.DhDataOutputStream;
|
||||
@@ -36,8 +35,8 @@ import java.io.IOException;
|
||||
import java.util.zip.Adler32;
|
||||
import java.util.zip.CheckedOutputStream;
|
||||
|
||||
/** handles storing {@link NewFullDataSource}'s in the database. */
|
||||
public class NewFullDataSourceDTO implements IBaseDTO<DhSectionPos>
|
||||
/** handles storing {@link FullDataSourceV2}'s in the database. */
|
||||
public class FullDataSourceV2DTO implements IBaseDTO<DhSectionPos>
|
||||
{
|
||||
public DhSectionPos pos;
|
||||
|
||||
@@ -67,20 +66,20 @@ public class NewFullDataSourceDTO implements IBaseDTO<DhSectionPos>
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public static NewFullDataSourceDTO CreateFromDataSource(NewFullDataSource dataSource, EDhApiDataCompressionMode compressionModeEnum) throws IOException
|
||||
public static FullDataSourceV2DTO CreateFromDataSource(FullDataSourceV2 dataSource, EDhApiDataCompressionMode compressionModeEnum) throws IOException
|
||||
{
|
||||
CheckedByteArray checkedDataPointArray = writeDataSourceDataArrayToBlob(dataSource.dataPoints, compressionModeEnum);
|
||||
byte[] mappingByteArray = writeDataMappingToBlob(dataSource.getMapping(), compressionModeEnum);
|
||||
|
||||
return new NewFullDataSourceDTO(
|
||||
return new FullDataSourceV2DTO(
|
||||
dataSource.getSectionPos(),
|
||||
checkedDataPointArray.checksum, dataSource.columnGenerationSteps, NewFullDataSource.DATA_FORMAT_VERSION, compressionModeEnum, checkedDataPointArray.byteArray,
|
||||
checkedDataPointArray.checksum, dataSource.columnGenerationSteps, FullDataSourceV2.DATA_FORMAT_VERSION, compressionModeEnum, checkedDataPointArray.byteArray,
|
||||
dataSource.lastModifiedUnixDateTime, dataSource.createdUnixDateTime,
|
||||
mappingByteArray, dataSource.applyToParent,
|
||||
dataSource.levelMinY
|
||||
);
|
||||
}
|
||||
public NewFullDataSourceDTO(
|
||||
public FullDataSourceV2DTO(
|
||||
DhSectionPos pos,
|
||||
int dataChecksum, byte[] columnGenStepByteArray, byte dataFormatVersion, EDhApiDataCompressionMode compressionModeEnum, byte[] dataByteArray,
|
||||
long lastModifiedUnixDateTime, long createdUnixDateTime,
|
||||
@@ -111,22 +110,22 @@ public class NewFullDataSourceDTO implements IBaseDTO<DhSectionPos>
|
||||
// data source population //
|
||||
//========================//
|
||||
|
||||
public NewFullDataSource createDataSource(@NotNull ILevelWrapper levelWrapper) throws IOException, InterruptedException
|
||||
{ return this.populateDataSource(NewFullDataSource.createEmpty(this.pos), levelWrapper); }
|
||||
public FullDataSourceV2 createDataSource(@NotNull ILevelWrapper levelWrapper) throws IOException, InterruptedException
|
||||
{ return this.populateDataSource(FullDataSourceV2.createEmpty(this.pos), levelWrapper); }
|
||||
|
||||
public NewFullDataSource populateDataSource(NewFullDataSource dataSource, @NotNull ILevelWrapper levelWrapper) throws IOException, InterruptedException
|
||||
public FullDataSourceV2 populateDataSource(FullDataSourceV2 dataSource, @NotNull ILevelWrapper levelWrapper) throws IOException, InterruptedException
|
||||
{ return this.internalPopulateDataSource(dataSource, levelWrapper, false); }
|
||||
|
||||
/**
|
||||
* May be missing one or more data fields. <br>
|
||||
* Designed to be used without access to Minecraft or any supporting objects.
|
||||
*/
|
||||
public NewFullDataSource createUnitTestDataSource() throws IOException, InterruptedException
|
||||
{ return this.internalPopulateDataSource(NewFullDataSource.createEmpty(this.pos), null, true); }
|
||||
public FullDataSourceV2 createUnitTestDataSource() throws IOException, InterruptedException
|
||||
{ return this.internalPopulateDataSource(FullDataSourceV2.createEmpty(this.pos), null, true); }
|
||||
|
||||
private NewFullDataSource internalPopulateDataSource(NewFullDataSource dataSource, ILevelWrapper levelWrapper, boolean unitTest) throws IOException, InterruptedException
|
||||
private FullDataSourceV2 internalPopulateDataSource(FullDataSourceV2 dataSource, ILevelWrapper levelWrapper, boolean unitTest) throws IOException, InterruptedException
|
||||
{
|
||||
if (NewFullDataSource.DATA_FORMAT_VERSION != this.dataFormatVersion)
|
||||
if (FullDataSourceV2.DATA_FORMAT_VERSION != this.dataFormatVersion)
|
||||
{
|
||||
throw new IllegalStateException("There should only be one data format right now anyway.");
|
||||
}
|
||||
@@ -175,7 +174,7 @@ public class NewFullDataSourceDTO implements IBaseDTO<DhSectionPos>
|
||||
|
||||
|
||||
// write the data
|
||||
int dataArrayLength = NewFullDataSource.WIDTH * NewFullDataSource.WIDTH;
|
||||
int dataArrayLength = FullDataSourceV2.WIDTH * FullDataSourceV2.WIDTH;
|
||||
for (int xz = 0; xz < dataArrayLength; xz++)
|
||||
{
|
||||
long[] dataColumn = dataArray[xz];
|
||||
@@ -206,7 +205,7 @@ public class NewFullDataSourceDTO implements IBaseDTO<DhSectionPos>
|
||||
|
||||
|
||||
// read the data
|
||||
int dataArrayLength = NewFullDataSource.WIDTH * NewFullDataSource.WIDTH;
|
||||
int dataArrayLength = FullDataSourceV2.WIDTH * FullDataSourceV2.WIDTH;
|
||||
long[][] dataArray = new long[dataArrayLength][];
|
||||
for (int xz = 0; xz < dataArray.length; xz++)
|
||||
{
|
||||
+8
-8
@@ -21,7 +21,7 @@ package com.seibel.distanthorizons.core.sql.repo;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.NewFullDataSourceDTO;
|
||||
import com.seibel.distanthorizons.core.sql.dto.FullDataSourceV2DTO;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@@ -29,11 +29,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NewFullDataSourceRepo extends AbstractDhRepo<DhSectionPos, NewFullDataSourceDTO>
|
||||
public class FullDataSourceV2Repo extends AbstractDhRepo<DhSectionPos, FullDataSourceV2DTO>
|
||||
{
|
||||
public NewFullDataSourceRepo(String databaseType, String databaseLocation) throws SQLException
|
||||
public FullDataSourceV2Repo(String databaseType, String databaseLocation) throws SQLException
|
||||
{
|
||||
super(databaseType, databaseLocation, NewFullDataSourceDTO.class);
|
||||
super(databaseType, databaseLocation, FullDataSourceV2DTO.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class NewFullDataSourceRepo extends AbstractDhRepo<DhSectionPos, NewFullD
|
||||
//=======================//
|
||||
|
||||
@Override
|
||||
public NewFullDataSourceDTO convertDictionaryToDto(Map<String, Object> objectMap) throws ClassCastException
|
||||
public FullDataSourceV2DTO convertDictionaryToDto(Map<String, Object> objectMap) throws ClassCastException
|
||||
{
|
||||
byte detailLevel = (Byte) objectMap.get("DetailLevel");
|
||||
byte sectionDetailLevel = (byte) (detailLevel + DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL);
|
||||
@@ -80,7 +80,7 @@ public class NewFullDataSourceRepo extends AbstractDhRepo<DhSectionPos, NewFullD
|
||||
long lastModifiedUnixDateTime = (Long) objectMap.get("LastModifiedUnixDateTime");
|
||||
long createdUnixDateTime = (Long) objectMap.get("CreatedUnixDateTime");
|
||||
|
||||
NewFullDataSourceDTO dto = new NewFullDataSourceDTO(
|
||||
FullDataSourceV2DTO dto = new FullDataSourceV2DTO(
|
||||
pos,
|
||||
dataChecksum, columnGenStepByteArray, dataFormatVersion, compressionModeEnum, dataByteArray,
|
||||
lastModifiedUnixDateTime, createdUnixDateTime,
|
||||
@@ -90,7 +90,7 @@ public class NewFullDataSourceRepo extends AbstractDhRepo<DhSectionPos, NewFullD
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement createInsertStatement(NewFullDataSourceDTO dto) throws SQLException
|
||||
public PreparedStatement createInsertStatement(FullDataSourceV2DTO dto) throws SQLException
|
||||
{
|
||||
String sql =
|
||||
"INSERT INTO "+this.getTableName() + " (\n" +
|
||||
@@ -131,7 +131,7 @@ public class NewFullDataSourceRepo extends AbstractDhRepo<DhSectionPos, NewFullD
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedStatement createUpdateStatement(NewFullDataSourceDTO dto) throws SQLException
|
||||
public PreparedStatement createUpdateStatement(FullDataSourceV2DTO dto) throws SQLException
|
||||
{
|
||||
String sql =
|
||||
"UPDATE "+this.getTableName()+" \n" +
|
||||
@@ -31,7 +31,7 @@ import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSour
|
||||
* </code>
|
||||
*
|
||||
* @see FullDataSourceV1
|
||||
* @see FullDataPointUtil
|
||||
* @see FullDataPointUtilV2
|
||||
*/
|
||||
public class FullDataPointUtilV1
|
||||
{
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ import org.jetbrains.annotations.Contract;
|
||||
* @see RenderDataPointUtil
|
||||
* @see FullDataPointUtilV1
|
||||
*/
|
||||
public class FullDataPointUtil
|
||||
public class FullDataPointUtilV2
|
||||
{
|
||||
/** Represents the data held by an empty data point */
|
||||
public static final int EMPTY_DATA_POINT = 0;
|
||||
@@ -29,7 +29,7 @@ import com.seibel.distanthorizons.core.dataObjects.render.columnViews.IColumnDat
|
||||
* A helper class that is used to access the data from a long
|
||||
* formatted as a render data point. <br><br>
|
||||
*
|
||||
* To access data from a long formatted as a full data point see: {@link FullDataPointUtil}
|
||||
* To access data from a long formatted as a full data point see: {@link FullDataPointUtilV2}
|
||||
*
|
||||
* <strong>DataPoint Format: </strong><br>
|
||||
* <code>
|
||||
@@ -55,7 +55,7 @@ import com.seibel.distanthorizons.core.dataObjects.render.columnViews.IColumnDat
|
||||
* BL BL BL BL SL SL SL SL | <br>
|
||||
* </code>
|
||||
*
|
||||
* @see FullDataPointUtil
|
||||
* @see FullDataPointUtilV2
|
||||
*/
|
||||
public class RenderDataPointUtil
|
||||
{
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
|
||||
0010-sqlite-createInitialDataTables.sql
|
||||
0020-sqlite-createGeneratedFullDataSourceTables.sql
|
||||
0020-sqlite-createFullDataSourceV2Tables.sql
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
package tests;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.config.EDhApiDataCompressionMode;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.NewFullDataSource;
|
||||
import com.seibel.distanthorizons.core.dataObjects.fullData.sources.FullDataSourceV2;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.sql.dto.NewFullDataSourceDTO;
|
||||
import com.seibel.distanthorizons.core.sql.repo.NewFullDataSourceRepo;
|
||||
import com.seibel.distanthorizons.core.sql.dto.FullDataSourceV2DTO;
|
||||
import com.seibel.distanthorizons.core.sql.repo.FullDataSourceV2Repo;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.*;
|
||||
@@ -155,7 +155,7 @@ public class CompressionTest
|
||||
// byte[] dictionary;
|
||||
// {
|
||||
// String uncompressedDatabaseFilePath = TEST_DIR + "/" + UNCOMPRESSED_DB_FILE_NAME;
|
||||
// NewFullDataSourceRepo uncompressedRepo = new NewFullDataSourceRepo("jdbc:sqlite", uncompressedDatabaseFilePath);
|
||||
// FullDataSourceV2Repo uncompressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", uncompressedDatabaseFilePath);
|
||||
// ArrayList<DhSectionPos> positionList = uncompressedRepo.getAllPositions();
|
||||
//
|
||||
// // sample size of 10 MB or less
|
||||
@@ -165,7 +165,7 @@ public class CompressionTest
|
||||
// for (int i = 0; i < positionList.size(); i++)
|
||||
// {
|
||||
// DhSectionPos pos = positionList.get(i);
|
||||
// NewFullDataSourceDTO uncompressedDto = uncompressedRepo.getByKey(pos);
|
||||
// FullDataSourceV2DTO uncompressedDto = uncompressedRepo.getByKey(pos);
|
||||
//
|
||||
// dictTrainer.addSample(uncompressedDto.dataByteArray);
|
||||
// }
|
||||
@@ -260,7 +260,7 @@ public class CompressionTest
|
||||
File uncompressedDatabaseFile = new File(uncompressedDatabaseFilePath);
|
||||
Assert.assertTrue(uncompressedDatabaseFile.exists());
|
||||
|
||||
NewFullDataSourceRepo uncompressedRepo = new NewFullDataSourceRepo("jdbc:sqlite", uncompressedDatabaseFilePath);
|
||||
FullDataSourceV2Repo uncompressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", uncompressedDatabaseFilePath);
|
||||
|
||||
|
||||
String compressedDatabaseFilePath = TEST_DIR + "/output/" + DB_FILE_NAME_PREFIX + "_" + compressorName + ".sqlite";
|
||||
@@ -268,7 +268,7 @@ public class CompressionTest
|
||||
compressedDatabaseFile.mkdirs();
|
||||
compressedDatabaseFile.delete();
|
||||
Assert.assertTrue(!compressedDatabaseFile.exists());
|
||||
NewFullDataSourceRepo compressedRepo = new NewFullDataSourceRepo("jdbc:sqlite", compressedDatabaseFilePath);
|
||||
FullDataSourceV2Repo compressedRepo = new FullDataSourceV2Repo("jdbc:sqlite", compressedDatabaseFilePath);
|
||||
|
||||
|
||||
|
||||
@@ -292,9 +292,9 @@ public class CompressionTest
|
||||
|
||||
// uncompressed input //
|
||||
|
||||
NewFullDataSourceDTO uncompressedDto = uncompressedRepo.getByKey(pos);
|
||||
FullDataSourceV2DTO uncompressedDto = uncompressedRepo.getByKey(pos);
|
||||
Assert.assertEquals(uncompressedDto.compressionModeEnum, EDhApiDataCompressionMode.UNCOMPRESSED);
|
||||
NewFullDataSource uncompressedDataSource = uncompressedDto.createUnitTestDataSource();
|
||||
FullDataSourceV2 uncompressedDataSource = uncompressedDto.createUnitTestDataSource();
|
||||
|
||||
long uncompressedDtoSize = uncompressedRepo.getDataSizeInBytes(pos);
|
||||
minUncompressedDtoSizeInBytes = Math.min(uncompressedDtoSize, minUncompressedDtoSizeInBytes);
|
||||
@@ -307,7 +307,7 @@ public class CompressionTest
|
||||
|
||||
long startWriteNanoTime = System.nanoTime();
|
||||
|
||||
NewFullDataSourceDTO compressedDto = NewFullDataSourceDTO.CreateFromDataSource(uncompressedDataSource, compressionMode);
|
||||
FullDataSourceV2DTO compressedDto = FullDataSourceV2DTO.CreateFromDataSource(uncompressedDataSource, compressionMode);
|
||||
compressedRepo.save(compressedDto);
|
||||
|
||||
long endWriteNanoTime = System.nanoTime();
|
||||
@@ -326,7 +326,7 @@ public class CompressionTest
|
||||
long startReadNanoTime = System.nanoTime();
|
||||
|
||||
compressedDto = compressedRepo.getByKey(pos);
|
||||
NewFullDataSource compressedDataSource = compressedDto.createUnitTestDataSource();
|
||||
FullDataSourceV2 compressedDataSource = compressedDto.createUnitTestDataSource();
|
||||
|
||||
long endReadMsTime = System.nanoTime();
|
||||
totalReadTimeInNano += (endReadMsTime - startReadNanoTime);
|
||||
|
||||
Reference in New Issue
Block a user