Added enumerators for organizing biome information.

Currently unused.
This commit is contained in:
Harrison Deng 2020-05-05 11:35:18 -05:00
parent 9d77fe3bb6
commit ce4a5899cc
2 changed files with 149 additions and 0 deletions

View File

@ -9,8 +9,151 @@ import org.bukkit.block.Biome;
import org.bukkit.util.noise.SimplexOctaveGenerator;
import ca.recrown.islandsurvivalcraft.utilities.GeneralUtilities;
import ca.recrown.islandsurvivalcraft.world.TemperatureMap.TemperatureRegion;
public class BiomeMap {
public enum MainBiomes {
SNOWY_TUNDRA(0.0f, TemperatureRegion.SNOWY, ShoreBiomes.SNOWY_BEACH),
ICE_SPIKES(0.0f, TemperatureRegion.SNOWY, ShoreBiomes.SNOWY_BEACH),
SNOWY_TAIGA(-0.5f, TemperatureRegion.SNOWY, ShoreBiomes.SNOWY_BEACH),
SNOWY_TAIGA_MOUNTAINS(-0.5f, TemperatureRegion.SNOWY, ShoreBiomes.SNOWY_BEACH),
MOUNTAINS(0.2f, TemperatureRegion.COLD, ShoreBiomes.STONE_SHORE),
GRAVELLY_MOUNTAINS(0.2f, TemperatureRegion.COLD),
WOODED_MOUNTAINS(0.2f, TemperatureRegion.COLD, ShoreBiomes.STONE_SHORE),
MODIFIED_GRAVELLY_MOUNTAINS(0.2f, TemperatureRegion.COLD),
TAIGA(0.25f, TemperatureRegion.COLD),
TAIGA_MOUNTAINS(0.25f, TemperatureRegion.COLD),
GIANT_TREE_TAIGA(0.3f, TemperatureRegion.COLD),
GIANT_SPRUCE_TAIGA(0.25f, TemperatureRegion.COLD),
PLAINS(0.8f, TemperatureRegion.LUSH),
SUNFLOWER_PLAINS(0.8f, TemperatureRegion.LUSH),
FOREST(0.7f, TemperatureRegion.LUSH),
FLOWER_FOREST(0.7f, TemperatureRegion.LUSH),
BIRCH_FOREST(0.6f, TemperatureRegion.LUSH),
TALL_BIRCH_FOREST(0.7f, TemperatureRegion.LUSH),
DARK_FOREST(0.7f, TemperatureRegion.LUSH),
DARK_FOREST_HILLS(0.7f, TemperatureRegion.LUSH),
SWAMP(0.8f, TemperatureRegion.LUSH),
SWAMP_HILLS(0.8f, TemperatureRegion.LUSH),
JUNGLE(0.95f, TemperatureRegion.LUSH),
MODIFIED_JUNGLE(0.95f, TemperatureRegion.LUSH),
JUNGLE_EDGE(0.95f, TemperatureRegion.LUSH),
MODIFIED_JUNGLE_EDGE(0.95f, TemperatureRegion.LUSH),
BAMBOO_JUNGLE(0.95f, TemperatureRegion.LUSH),
MUSHROOM_FIELDS(0.9f, TemperatureRegion.LUSH, ShoreBiomes.MUSHROOM_SHORE),
DESERT(2.0f, TemperatureRegion.WARM),
SAVANNA(1.2f, TemperatureRegion.WARM),
SHATTERED_SAVANNA(1.1f, TemperatureRegion.WARM),
BADLANDS(2.0f, TemperatureRegion.WARM),
ERODED_BADLANDS(2.0f, TemperatureRegion.WARM),
WOODED_BADLANDS_PLATEAU(2.0f, TemperatureRegion.WARM),
MODIFIED_WOODED_BADLANDS_PLATEAU(2.0f, TemperatureRegion.WARM),
BADLANDS_PLATEAU(2.0f, TemperatureRegion.WARM),
SAVANNA_PLATEAU(1.0f, TemperatureRegion.WARM),
MODIFIED_BADLANDS_PLATEAU(2.0f, TemperatureRegion.WARM),
SHATTERED_SAVANNA_PLATEAU(1.0f, TemperatureRegion.WARM),
;
private final float temperature;
private final TemperatureRegion temperatureRegion;
private final ShoreBiomes[] preferredShores;
private MainBiomes(float temperature, TemperatureRegion temperatureRegion, ShoreBiomes... preferredShore) {
this.temperature = temperature;
this.preferredShores = preferredShore;
this.temperatureRegion = temperatureRegion;
}
/**
* @return the temperature
*/
public float getTemperature() {
return temperature;
}
/**
* @return the preferredShore
*/
public ShoreBiomes[] getPreferredShores() {
return preferredShores;
}
/**
* @return the temperatureRegion
*/
public TemperatureRegion getTemperatureRegion() {
return temperatureRegion;
}
}
public enum OceanBiomes {
WARM_OCEAN(0.5f, TemperatureRegion.WARM),
LUKEWARM_OCEAN(0.5f, TemperatureRegion.LUSH),
OCEAN(0.5f, TemperatureRegion.LUSH),
COLD_OCEAN(0.5f, TemperatureRegion.COLD),
FROZEN_OCEAN(0.0f, TemperatureRegion.SNOWY);
private final float temperature;
private final TemperatureRegion temperatureRegion;
private OceanBiomes(float temperature, TemperatureRegion temperatureRegion) {
this.temperature = temperature;
this.temperatureRegion = temperatureRegion;
}
/**
* @return the temperature
*/
public float getTemperature() {
return temperature;
}
/**
* @return the temperatureRegion
*/
public TemperatureRegion getTemperatureRegion() {
return temperatureRegion;
}
}
public enum ShoreBiomes {
BEACH(0.8f, TemperatureRegion.LUSH),
SNOWY_BEACH(0.05f, TemperatureRegion.SNOWY),
MUSHROOM_SHORE(0.05f, TemperatureRegion.LUSH, true),
STONE_SHORE(0.2f, TemperatureRegion.COLD);
private final float temperature;
private final TemperatureRegion temperatureRegion;
private final boolean special;
private ShoreBiomes(float temperature, TemperatureRegion associatedTemperatureRegion, boolean special) {
this.temperature = temperature;
this.temperatureRegion = associatedTemperatureRegion;
this.special = special;
}
private ShoreBiomes(float temperature, TemperatureRegion associatedTemperatureRegion) {
this(temperature, associatedTemperatureRegion, false);
}
/**
* @return the temperature
*/
public float getTemperature() {
return temperature;
}
/**
* @return the temperatureRegion
*/
public TemperatureRegion getTemperatureRegion() {
return temperatureRegion;
}
/**
* @return the special
*/
public boolean isSpecial() {
return special;
}
}
private final SimplexOctaveGenerator noise;
private final HashMap<Biome, Float> landBiomeTemperatures = new HashMap<>();
private volatile HashMap<Float, ArrayList<Biome>> temperaturesForLand = new HashMap<>();

View File

@ -8,6 +8,12 @@ import ca.recrown.islandsurvivalcraft.utilities.caching.Cache;
import ca.recrown.islandsurvivalcraft.utilities.datatypes.Point2;
public class TemperatureMap {
public enum TemperatureRegion {
SNOWY,
COLD,
LUSH,
WARM,
}
private final Cache<Point2, Float> temperatureCache;
private final double frequency = 0.5D;
private final double amplitude = 0.5D;