Preliminary new unique biome generator.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,6 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -20,19 +19,17 @@ import org.junit.jupiter.api.Timeout;
|
||||
import org.junit.jupiter.api.TestInstance.Lifecycle;
|
||||
|
||||
import ca.recrown.islandsurvivalcraft.utilities.GeneralUtilities;
|
||||
import ca.recrown.islandsurvivalcraft.utilities.biomes.BiomeInfo;
|
||||
import ca.recrown.islandsurvivalcraft.utilities.caching.Cache;
|
||||
import ca.recrown.islandsurvivalcraft.utilities.datatypes.Point2;
|
||||
import ca.recrown.islandsurvivalcraft.world.BiomeMap;
|
||||
import ca.recrown.islandsurvivalcraft.world.IslandWorldMap;
|
||||
import ca.recrown.islandsurvivalcraft.world.TemperatureMap;
|
||||
import ca.recrown.islandsurvivalcraft.world.generation.DummyWorld;
|
||||
|
||||
@TestInstance(Lifecycle.PER_CLASS)
|
||||
public class UniqueBiomeGeneratorTest {
|
||||
private final int SEED = 249398015;
|
||||
private final DummyWorld dummyWorld = new DummyWorld();
|
||||
private volatile Cache<Point2, Double> blockValueCache;
|
||||
private volatile Cache<Point2, Biome[]> biomeCache;
|
||||
private volatile Cache<Point2, BiomeInfo> biomeCache;
|
||||
private final BiomeMap biomeSelector = new BiomeMap(new Random(SEED));
|
||||
|
||||
|
||||
@@ -59,11 +56,11 @@ public class UniqueBiomeGeneratorTest {
|
||||
TemperatureMap temperatureMapGenerator = new TemperatureMap(random);
|
||||
BiomeGenerator biomeGenerator = new UniqueBiomeGenerator();
|
||||
|
||||
Biome[][][] biomes = new Biome[GeneralUtilities.CHUNK_SIZE][GeneralUtilities.CHUNK_SIZE][4];
|
||||
BiomeInfo[][] biomes = new BiomeInfo[GeneralUtilities.CHUNK_SIZE][GeneralUtilities.CHUNK_SIZE];
|
||||
for (int localX = 0; localX < GeneralUtilities.CHUNK_SIZE; localX++) {
|
||||
for (int localZ = 0; localZ < GeneralUtilities.CHUNK_SIZE; localZ++) {
|
||||
if (biomes[localX][localZ] == null) {
|
||||
biomeGenerator.generateBiomeColumn(biomes, dummyWorld, chunkX, chunkZ, localX, localZ, mapper,
|
||||
biomeGenerator.generateBiomeColumn(biomes, chunkX, chunkZ, localX, localZ, mapper,
|
||||
biomeSelector, temperatureMapGenerator, biomeCache);
|
||||
}
|
||||
if (biomes[localX][localZ] == null)
|
||||
@@ -79,13 +76,11 @@ public class UniqueBiomeGeneratorTest {
|
||||
|
||||
@BeforeEach
|
||||
public void individualSetup() {
|
||||
blockValueCache = new Cache<>(524288);
|
||||
biomeCache = new Cache<>(524288);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void individualCleanup() {
|
||||
blockValueCache.clearCache();
|
||||
biomeCache.clearCache();
|
||||
}
|
||||
|
||||
@@ -122,7 +117,6 @@ public class UniqueBiomeGeneratorTest {
|
||||
@Test
|
||||
@Timeout(value = 1, unit = TimeUnit.MINUTES)
|
||||
public void testBiomeGenerationMultithread1608ChunksSmallCache() {
|
||||
this.blockValueCache = new Cache<>(1024);
|
||||
this.biomeCache = new Cache<>(1024);
|
||||
|
||||
int chunksToDoEach = 268;
|
||||
@@ -192,7 +186,6 @@ public class UniqueBiomeGeneratorTest {
|
||||
@Test
|
||||
@Timeout(value = 1, unit = TimeUnit.MINUTES)
|
||||
public void testBiomeGenerationMultithread1608ChunksScatteredColumnsSmallCache() {
|
||||
this.blockValueCache = new Cache<>(1024);
|
||||
this.biomeCache = new Cache<>(1024);
|
||||
int chunksToDoEach = 268;
|
||||
Runnable g1 = new BiomeGenTask(chunksToDoEach, 0);
|
||||
@@ -254,7 +247,6 @@ public class UniqueBiomeGeneratorTest {
|
||||
@Test
|
||||
@Timeout(value = 1, unit = TimeUnit.MINUTES)
|
||||
public void testBiomeGenerationMultithread6000ChunksScatteredColumnsSmallCache() {
|
||||
this.blockValueCache = new Cache<>(1024);
|
||||
this.biomeCache = new Cache<>(1024);
|
||||
|
||||
int chunksToDoEach = 1000;
|
||||
|
Reference in New Issue
Block a user