Overworld general terrain generation complete.

Added warning supression for unused as it may be used in the future.
This commit is contained in:
Harrison Deng 2020-05-03 18:24:23 -05:00
parent a077ec6c0e
commit fc9aca3bb1
6 changed files with 43 additions and 39 deletions

View File

@ -11,8 +11,8 @@ import ca.recrown.islandsurvivalcraft.datatypes.Point2;
public class Utilities {
public final static int CHUNK_SIZE = 16;
public final static ExecutorService ISC_EXECUTOR_ALPHA = Executors.newFixedThreadPool(1, createThreadFactory("ALPHA", Thread.NORM_PRIORITY));
public final static ExecutorService ISC_EXECUTOR_BETA = Executors.newFixedThreadPool(2, createThreadFactory("BETA", Thread.MIN_PRIORITY));
public final static ExecutorService ISC_EXECUTOR_ALPHA = Executors.newFixedThreadPool(1, createThreadFactory("ALPHA", Thread.NORM_PRIORITY + 1));
public final static ExecutorService ISC_EXECUTOR_BETA = Executors.newFixedThreadPool(2, createThreadFactory("BETA", Thread.NORM_PRIORITY));
public static <K, V> HashMap<V, ArrayList<K>> invertHashMap(HashMap<K, V> hashMap) {
HashMap<V, ArrayList<K>> res = new HashMap<>();

View File

@ -0,0 +1,13 @@
package ca.recrown.islandsurvivalcraft.preferences;
import java.io.Serializable;
public class GeneralConfiguration implements Serializable {
/**
*
*/
private static final long serialVersionUID = 5820622075140630470L;
}

View File

@ -130,6 +130,31 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
return location;
}
@Override
public boolean canSpawn(World world, int x, int z) {
IslandWorldMapper mapper = new IslandWorldMapper(world.getSeed(), blockValueCache);
return mapper.isLand(x, z);
}
@Override
public boolean shouldGenerateCaves() {
return true;
}
@Override
public boolean shouldGenerateDecorations() {
return true;
}
@Override
public boolean shouldGenerateStructures() {
return true;
}
@Override
public boolean shouldGenerateMobs() {
return true;
}
@Override
public boolean isParallelCapable() {

View File

@ -1,18 +0,0 @@
package ca.recrown.islandsurvivalcraft.world.generation.populators;
import java.util.Random;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
public class TreePopulator extends BlockPopulator {
@Override
public void populate(World world, Random random, Chunk source) {
if (random.nextBoolean()) {
}
}
}

View File

@ -31,12 +31,11 @@ public class WorldHeightShader {
} else if (biomeName.contains("beach")) {
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 5d));
} else if (biomeName.contains("shore")) {
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 20d));
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 30d));
} else {
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0], 0d) + 1;
}
if (biomeName.contains("snowy")) height++;
if (height > worldHeight) throw new IllegalStateException("Resulting height is greater than world height! Biome this occurred on: " + biomeName);
height = Math.max(minimumHeight, height);
return height;

View File

@ -5,13 +5,13 @@ import java.util.Random;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Snowable;
import org.bukkit.util.noise.SimplexOctaveGenerator;
import ca.recrown.islandsurvivalcraft.caching.Cache;
import ca.recrown.islandsurvivalcraft.datatypes.Vector3;
import ca.recrown.islandsurvivalcraft.world.IslandWorldMapper;
@SuppressWarnings("unused")
public class WorldLayerShader {
private final Cache<Vector3, Double> noiseCache = new Cache<>(256);
private final SimplexOctaveGenerator noise;
@ -82,7 +82,7 @@ public class WorldLayerShader {
}
}
} else if (mainBiomeName.contains("mountain")) {
if (y > (maxHeight * 0.48d) - getNormalizedNoise(worldX, worldZ, 2f) * 6d) {
if (y > (maxHeight * 0.48d) - getNormalizedNoise(worldX, worldZ, 2.2f) * 8d) {
res = Material.STONE.createBlockData();
} else if (y > highestPoint - getSurfaceThickness(worldX, worldZ, mainBiome)) {
res = getSurfaceMaterial(mainBiome).createBlockData();
@ -91,20 +91,6 @@ public class WorldLayerShader {
}
}
if (mainBiomeName.contains("snowy")) {
if (highestPoint == y) {
res = Material.SNOW.createBlockData();
} else if (y > highestPoint - 1 - getSurfaceThickness(worldX, worldZ, mainBiome)) {
if (res == null || res.getMaterial() == Material.DIRT) res = getSurfaceMaterial(mainBiome).createBlockData();
if (res.getMaterial() == Material.GRASS_BLOCK) {
Snowable snowable = (Snowable) res;
snowable.setSnowy(true);
}
} else if (y > highestPoint - 1 - getSurfaceThickness(worldX, worldZ, mainBiome) - getTransitionMaterialThickness(worldX, worldZ, mainBiome)) {
if (res == null) res = getTransitionMaterial(mainBiome).createBlockData();
}
}
return res;
}
@ -128,7 +114,6 @@ public class WorldLayerShader {
if (biomeName.contains("beach")) {
return (int) (getNormalizedNoise(worldX, worldZ, 1.3f) * 5) + 4;
}
return 1;
}