Implemented better biome system.
This commit is contained in:
parent
d1cae3bf7f
commit
a5cf40913b
@ -0,0 +1,93 @@
|
|||||||
|
package ca.recrown.islandsurvivalcraft.utilities.biomes;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
import ca.recrown.islandsurvivalcraft.utilities.weighting.Weightable;
|
||||||
|
import ca.recrown.islandsurvivalcraft.utilities.weighting.WeightedSelector;
|
||||||
|
|
||||||
|
public enum BiomeClassifications implements Weightable {
|
||||||
|
SNOWY(0.2f, new OceanBiomeInfo(Biome.FROZEN_OCEAN, Biome.COLD_OCEAN, Biome.DEEP_FROZEN_OCEAN),
|
||||||
|
new LandBiomeInfo(Biome.SNOWY_TAIGA, null, Biome.SNOWY_TAIGA_HILLS, Biome.SNOWY_BEACH, 0.3f),
|
||||||
|
new LandBiomeInfo(Biome.SNOWY_TAIGA_MOUNTAINS, Biome.SNOWY_TAIGA, null, Biome.SNOWY_BEACH, 0.25f),
|
||||||
|
new LandBiomeInfo(Biome.SNOWY_TUNDRA, null, null, Biome.SNOWY_BEACH, 0.3f),
|
||||||
|
new LandBiomeInfo(Biome.ICE_SPIKES, null, null, Biome.SNOWY_BEACH, 0.15f)
|
||||||
|
),
|
||||||
|
COLD(0.3f, new OceanBiomeInfo(Biome.COLD_OCEAN, null, Biome.DEEP_COLD_OCEAN),
|
||||||
|
new LandBiomeInfo(Biome.MOUNTAINS, null, null, Biome.STONE_SHORE, 0.14f),
|
||||||
|
new LandBiomeInfo(Biome.GRAVELLY_MOUNTAINS, 0.1f),
|
||||||
|
new LandBiomeInfo(Biome.WOODED_MOUNTAINS, 0.08f),
|
||||||
|
new LandBiomeInfo(Biome.MODIFIED_GRAVELLY_MOUNTAINS, 0.08f),
|
||||||
|
new LandBiomeInfo(Biome.TAIGA, null, Biome.TAIGA_HILLS, Biome.BEACH, 0.15f),
|
||||||
|
new LandBiomeInfo(Biome.TAIGA_MOUNTAINS, 0.15f),
|
||||||
|
new LandBiomeInfo(Biome.GIANT_TREE_TAIGA, null, Biome.GIANT_TREE_TAIGA_HILLS, Biome.BEACH, 0.15f),
|
||||||
|
new LandBiomeInfo(Biome.GIANT_SPRUCE_TAIGA, null, Biome.GIANT_SPRUCE_TAIGA_HILLS, Biome.BEACH, 0.15f)
|
||||||
|
),
|
||||||
|
LUSH(0.3f, new OceanBiomeInfo(Biome.WARM_OCEAN, Biome.LUKEWARM_OCEAN, Biome.DEEP_LUKEWARM_OCEAN),
|
||||||
|
new LandBiomeInfo(Biome.PLAINS, 0.15f),
|
||||||
|
new LandBiomeInfo(Biome.SUNFLOWER_PLAINS, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.FOREST, null, Biome.WOODED_HILLS, Biome.BEACH, 0.1f),
|
||||||
|
new LandBiomeInfo(Biome.FLOWER_FOREST, 0.05f),
|
||||||
|
new LandBiomeInfo(Biome.BIRCH_FOREST, null, Biome.BIRCH_FOREST_HILLS, Biome.BEACH, 0.1f),
|
||||||
|
new LandBiomeInfo(Biome.TALL_BIRCH_FOREST, null, Biome.TALL_BIRCH_HILLS, Biome.BEACH, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.DARK_FOREST, null, Biome.DARK_FOREST_HILLS, Biome.BEACH, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.SWAMP, null, Biome.SWAMP_HILLS, null, 0.1f),
|
||||||
|
new LandBiomeInfo(Biome.JUNGLE, Biome.JUNGLE_EDGE, Biome.JUNGLE_HILLS, Biome.BEACH, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.MODIFIED_JUNGLE, Biome.MODIFIED_JUNGLE_EDGE, null, Biome.BEACH, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.BAMBOO_JUNGLE, null, Biome.BAMBOO_JUNGLE_HILLS, Biome.BEACH, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.MUSHROOM_FIELDS, null, null, Biome.MUSHROOM_FIELD_SHORE, 0.05f)
|
||||||
|
),
|
||||||
|
WARM(0.2f, new OceanBiomeInfo(Biome.OCEAN, null, Biome.DEEP_OCEAN),
|
||||||
|
new LandBiomeInfo(Biome.DESERT, null, Biome.DESERT_HILLS, Biome.BEACH, 0.2f),
|
||||||
|
new LandBiomeInfo(Biome.SAVANNA, 0.2f),
|
||||||
|
new LandBiomeInfo(Biome.SHATTERED_SAVANNA, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.BADLANDS, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.ERODED_BADLANDS, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.WOODED_BADLANDS_PLATEAU, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.MODIFIED_WOODED_BADLANDS_PLATEAU, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.BADLANDS_PLATEAU, 0.075f),
|
||||||
|
new LandBiomeInfo(Biome.SAVANNA_PLATEAU, 0.05f),
|
||||||
|
new LandBiomeInfo(Biome.MODIFIED_BADLANDS_PLATEAU, 0.05f),
|
||||||
|
new LandBiomeInfo(Biome.SHATTERED_SAVANNA_PLATEAU, 0.05f)
|
||||||
|
),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final LandBiomeInfo[] biomeInfos;
|
||||||
|
private final float weight;
|
||||||
|
private final OceanBiomeInfo associatedOceanBiomeInfo;
|
||||||
|
private final WeightedSelector<LandBiomeInfo> selector;
|
||||||
|
|
||||||
|
BiomeClassifications(float weight, OceanBiomeInfo oceanBiomeInfo, LandBiomeInfo... biomeInfos) {
|
||||||
|
this.biomeInfos = biomeInfos;
|
||||||
|
this.weight = weight;
|
||||||
|
this.associatedOceanBiomeInfo = oceanBiomeInfo;
|
||||||
|
selector = new WeightedSelector<>(Arrays.asList(biomeInfos));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the biomes associated with this classification.
|
||||||
|
*/
|
||||||
|
public LandBiomeInfo[] getBiomeInfos() {
|
||||||
|
return biomeInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the associatedOceanBiomeInfo
|
||||||
|
*/
|
||||||
|
public OceanBiomeInfo getAssociatedOceanBiomeInfo() {
|
||||||
|
return associatedOceanBiomeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the selector
|
||||||
|
*/
|
||||||
|
public WeightedSelector<LandBiomeInfo> getSelector() {
|
||||||
|
return selector;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package ca.recrown.islandsurvivalcraft.utilities.biomes;
|
||||||
|
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
import ca.recrown.islandsurvivalcraft.utilities.weighting.Weightable;
|
||||||
|
|
||||||
|
public class LandBiomeInfo implements Weightable {
|
||||||
|
private final Biome biome;
|
||||||
|
private final float weight;
|
||||||
|
private final Biome hillBiome;
|
||||||
|
private final Biome transitionBiome;
|
||||||
|
private final Biome preferredShore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a land biome information object.
|
||||||
|
* @param biome the main biome this object represents.
|
||||||
|
* @param transitionBiome the transition biome to go with this biome. May be null.
|
||||||
|
* @param hill the hill biome that goes with this biome. May be null.
|
||||||
|
* @param shore the preferred shore that goes with this biome. May be null.
|
||||||
|
* @param weight the weight, relative to the others, chance this biome spawns.
|
||||||
|
*/
|
||||||
|
public LandBiomeInfo(Biome biome, Biome transitionBiome, Biome hill, Biome shore, float weight) {
|
||||||
|
if (biome == null) throw new IllegalArgumentException("Argument biome may never be null.");
|
||||||
|
this.weight = weight;
|
||||||
|
this.biome = biome;
|
||||||
|
this.hillBiome = hill;
|
||||||
|
this.preferredShore = shore;
|
||||||
|
this.transitionBiome = transitionBiome;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LandBiomeInfo(Biome biome, float weight) {
|
||||||
|
this(biome, null, null, Biome.BEACH, weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the weight
|
||||||
|
*/
|
||||||
|
public float getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the biome
|
||||||
|
*/
|
||||||
|
public Biome getBiome() {
|
||||||
|
return biome;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the hill biome. May be null.
|
||||||
|
*/
|
||||||
|
public Biome getHillBiome() {
|
||||||
|
return hillBiome;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the shore biome.
|
||||||
|
*/
|
||||||
|
public Biome getPreferredShore() {
|
||||||
|
return preferredShore;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the transition biome if it has one. May be null.
|
||||||
|
*/
|
||||||
|
public Biome getTransitionBiome() {
|
||||||
|
return transitionBiome;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package ca.recrown.islandsurvivalcraft.utilities.biomes;
|
||||||
|
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
|
public class OceanBiomeInfo {
|
||||||
|
private final Biome ocean;
|
||||||
|
private final Biome transitionOcean;
|
||||||
|
private final Biome deepAlternative;
|
||||||
|
|
||||||
|
public OceanBiomeInfo(Biome ocean, Biome transitionOcean, Biome deepAlternative) {
|
||||||
|
if (ocean == null || deepAlternative == null) throw new IllegalArgumentException("Neither argument ocean nor deepAlternative may be null.");
|
||||||
|
this.ocean = ocean;
|
||||||
|
this.transitionOcean = transitionOcean;
|
||||||
|
this.deepAlternative = deepAlternative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the main ocean.
|
||||||
|
*/
|
||||||
|
public Biome getOcean() {
|
||||||
|
return ocean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the transition ocean. May be null.
|
||||||
|
*/
|
||||||
|
public Biome getTransitionOcean() {
|
||||||
|
return transitionOcean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the deep version of this ocean.
|
||||||
|
*/
|
||||||
|
public Biome getDeepAlternative() {
|
||||||
|
return deepAlternative;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package ca.recrown.islandsurvivalcraft.utilities.weighting;
|
||||||
|
|
||||||
|
public interface Weightable {
|
||||||
|
public float getWeight();
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package ca.recrown.islandsurvivalcraft.utilities.weighting;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
public class WeightedSelector<T extends Weightable> {
|
||||||
|
private final TreeMap<Float, T> map;
|
||||||
|
private final float totalWeights;
|
||||||
|
|
||||||
|
public WeightedSelector(Iterable<T> set) {
|
||||||
|
float totalWeights = 0;
|
||||||
|
map = new TreeMap<>();
|
||||||
|
for (T t : set) {
|
||||||
|
totalWeights += t.getWeight();
|
||||||
|
map.put(totalWeights, t);
|
||||||
|
}
|
||||||
|
this.totalWeights = totalWeights;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T selectRandom(Random random) {
|
||||||
|
return map.ceilingEntry(random.nextFloat() * totalWeights).getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public T selectRandom(float selector) {
|
||||||
|
return map.ceilingEntry(selector * totalWeights).getValue();
|
||||||
|
}
|
||||||
|
}
|
@ -1,275 +1,25 @@
|
|||||||
package ca.recrown.islandsurvivalcraft.world;
|
package ca.recrown.islandsurvivalcraft.world;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.util.noise.SimplexOctaveGenerator;
|
import org.bukkit.util.noise.SimplexOctaveGenerator;
|
||||||
|
|
||||||
import ca.recrown.islandsurvivalcraft.utilities.GeneralUtilities;
|
import ca.recrown.islandsurvivalcraft.utilities.biomes.BiomeClassifications;
|
||||||
import ca.recrown.islandsurvivalcraft.world.TemperatureMap.TemperatureRegion;
|
import ca.recrown.islandsurvivalcraft.utilities.biomes.LandBiomeInfo;
|
||||||
|
import ca.recrown.islandsurvivalcraft.utilities.biomes.OceanBiomeInfo;
|
||||||
|
|
||||||
public class BiomeMap {
|
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 SimplexOctaveGenerator noise;
|
||||||
private final HashMap<Biome, Float> landBiomeTemperatures = new HashMap<>();
|
|
||||||
private volatile HashMap<Float, ArrayList<Biome>> temperaturesForLand = new HashMap<>();
|
|
||||||
private final HashMap<Float, ArrayList<Biome>> temperaturePartitionedLandBiomes = new HashMap<>();
|
|
||||||
private final HashMap<Biome, Float> oceanBiomeTemperatures = new HashMap<>();
|
|
||||||
private volatile HashMap<Float, ArrayList<Biome>> temperaturesForOcean = new HashMap<>();
|
|
||||||
private final HashMap<Float, ArrayList<Biome>> temperaturePartitionedOceanBiomes = new HashMap<>();
|
|
||||||
|
|
||||||
public BiomeMap(Random random) {
|
public BiomeMap(Random random) {
|
||||||
this(random, 0.05d);
|
this(random, 0.02d);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeMap(Random random, double scale) {
|
public BiomeMap(Random random, double scale) {
|
||||||
noise = new SimplexOctaveGenerator(random, 2);
|
noise = new SimplexOctaveGenerator(random, 2);
|
||||||
noise.setScale(scale);
|
noise.setScale(scale);
|
||||||
temperaturePartitionedLandBiomes.put(0.05f, new ArrayList<>());
|
|
||||||
temperaturePartitionedLandBiomes.put(0.30f, new ArrayList<>());
|
|
||||||
temperaturePartitionedLandBiomes.put(0.95f, new ArrayList<>());
|
|
||||||
temperaturePartitionedLandBiomes.put(2f, new ArrayList<>());
|
|
||||||
|
|
||||||
temperaturePartitionedOceanBiomes.put(0.00f, new ArrayList<>());
|
|
||||||
temperaturePartitionedOceanBiomes.put(0.3f, new ArrayList<>());
|
|
||||||
temperaturePartitionedOceanBiomes.put(0.5f, new ArrayList<>());
|
|
||||||
|
|
||||||
registerLandBiomeTemperatures();
|
|
||||||
registerOceanBiomeTemperatures();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerLandBiomeTemperatures() {
|
|
||||||
landBiomeTemperatures.put(Biome.SNOWY_TUNDRA, 0.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.ICE_SPIKES, 0.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.SNOWY_TAIGA, -0.5f);
|
|
||||||
landBiomeTemperatures.put(Biome.SNOWY_TAIGA_MOUNTAINS, -0.5f);
|
|
||||||
landBiomeTemperatures.put(Biome.MOUNTAINS, 0.2f);
|
|
||||||
landBiomeTemperatures.put(Biome.GRAVELLY_MOUNTAINS, 0.2f);
|
|
||||||
landBiomeTemperatures.put(Biome.WOODED_MOUNTAINS, 0.2f);
|
|
||||||
landBiomeTemperatures.put(Biome.MODIFIED_GRAVELLY_MOUNTAINS, 0.2f);
|
|
||||||
landBiomeTemperatures.put(Biome.TAIGA, 0.25f);
|
|
||||||
landBiomeTemperatures.put(Biome.TAIGA_MOUNTAINS, 0.25f);
|
|
||||||
landBiomeTemperatures.put(Biome.GIANT_TREE_TAIGA, 0.3f);
|
|
||||||
landBiomeTemperatures.put(Biome.PLAINS, 0.8f);
|
|
||||||
landBiomeTemperatures.put(Biome.SUNFLOWER_PLAINS, 0.8f);
|
|
||||||
landBiomeTemperatures.put(Biome.FOREST, 0.7f);
|
|
||||||
landBiomeTemperatures.put(Biome.FLOWER_FOREST, 0.7f);
|
|
||||||
landBiomeTemperatures.put(Biome.BIRCH_FOREST, 0.6f);
|
|
||||||
landBiomeTemperatures.put(Biome.TALL_BIRCH_FOREST, 0.7f);
|
|
||||||
landBiomeTemperatures.put(Biome.DARK_FOREST, 0.7f);
|
|
||||||
landBiomeTemperatures.put(Biome.SWAMP, 0.8f);
|
|
||||||
landBiomeTemperatures.put(Biome.JUNGLE, 0.95f);
|
|
||||||
landBiomeTemperatures.put(Biome.MODIFIED_JUNGLE, 0.95f);
|
|
||||||
landBiomeTemperatures.put(Biome.BAMBOO_JUNGLE, 0.95f);
|
|
||||||
landBiomeTemperatures.put(Biome.MUSHROOM_FIELDS, 0.9f);
|
|
||||||
landBiomeTemperatures.put(Biome.DESERT, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.SAVANNA, 1.2f);
|
|
||||||
landBiomeTemperatures.put(Biome.SHATTERED_SAVANNA, 1.1f);
|
|
||||||
landBiomeTemperatures.put(Biome.BADLANDS, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.ERODED_BADLANDS, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.WOODED_BADLANDS_PLATEAU, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.MODIFIED_WOODED_BADLANDS_PLATEAU, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.SAVANNA_PLATEAU, 1.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.BADLANDS_PLATEAU, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.MODIFIED_BADLANDS_PLATEAU, 2.0f);
|
|
||||||
landBiomeTemperatures.put(Biome.SHATTERED_SAVANNA_PLATEAU, 1.0f);
|
|
||||||
temperaturesForLand = GeneralUtilities.invertHashMap(landBiomeTemperatures);
|
|
||||||
|
|
||||||
for (Entry<Float, ArrayList<Biome>> entry : temperaturesForLand.entrySet()) {
|
|
||||||
if (entry.getKey() <= 0.05f) {
|
|
||||||
temperaturePartitionedLandBiomes.get(0.05f).addAll(entry.getValue());
|
|
||||||
} else if (entry.getKey() <= 0.3) {
|
|
||||||
temperaturePartitionedLandBiomes.get(0.3f).addAll(entry.getValue());
|
|
||||||
} else if (entry.getKey() <= 0.85f) {
|
|
||||||
temperaturePartitionedLandBiomes.get(0.95f).addAll(entry.getValue());
|
|
||||||
} else {
|
|
||||||
temperaturePartitionedLandBiomes.get(2.00f).addAll(entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerOceanBiomeTemperatures() {
|
|
||||||
oceanBiomeTemperatures.put(Biome.WARM_OCEAN, 0.5f);
|
|
||||||
oceanBiomeTemperatures.put(Biome.LUKEWARM_OCEAN, 0.5f);
|
|
||||||
oceanBiomeTemperatures.put(Biome.OCEAN, 0.3f);
|
|
||||||
oceanBiomeTemperatures.put(Biome.COLD_OCEAN, 0.3f);
|
|
||||||
oceanBiomeTemperatures.put(Biome.FROZEN_OCEAN, 0f);
|
|
||||||
temperaturesForOcean = GeneralUtilities.invertHashMap(oceanBiomeTemperatures);
|
|
||||||
for (Entry<Float, ArrayList<Biome>> entry : temperaturesForOcean.entrySet()) {
|
|
||||||
if (entry.getKey() <= 0.00f) {
|
|
||||||
temperaturePartitionedOceanBiomes.get(0.0f).addAll(entry.getValue());
|
|
||||||
} else if (entry.getKey() <= 0.3f) {
|
|
||||||
temperaturePartitionedOceanBiomes.get(0.3f).addAll(entry.getValue());
|
|
||||||
} else {
|
|
||||||
temperaturePartitionedOceanBiomes.get(0.5f).addAll(entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Obtains the normal temperature for the given biome.
|
|
||||||
* @param biome The given biome.
|
|
||||||
* @return the Minecraft temperature.
|
|
||||||
*/
|
|
||||||
public float getBiomeTemperature(Biome biome) {
|
|
||||||
String biomeName = biome.name().toLowerCase();
|
|
||||||
if (biomeName.endsWith("hills") || biomeName.endsWith("beach") || biomeName.endsWith("shore")) {
|
|
||||||
String biomeTypeName = biomeName;
|
|
||||||
biomeTypeName = biomeTypeName.replace("_hills", "");
|
|
||||||
biomeTypeName = biomeTypeName.replace("_beach", "");
|
|
||||||
biomeTypeName = biomeTypeName.replace("_shore", "");
|
|
||||||
|
|
||||||
for (Entry<Biome, Float> entry : landBiomeTemperatures.entrySet()) {
|
|
||||||
if (entry.getKey().name().toLowerCase().startsWith(biomeTypeName)) {
|
|
||||||
return entry.getValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return landBiomeTemperatures.get(biome);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -286,57 +36,25 @@ public class BiomeMap {
|
|||||||
}
|
}
|
||||||
return Biome.JUNGLE_EDGE;
|
return Biome.JUNGLE_EDGE;
|
||||||
} else if (biomeName.contains("mountain")) {
|
} else if (biomeName.contains("mountain")) {
|
||||||
//return Biome.MOUNTAIN_EDGE;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public BiomeClassifications getClassification(float temperature) {
|
||||||
* Finds the shore biome from the given information.
|
if (temperature <= 0.1f) {
|
||||||
* @param from land biome that connects to it.
|
return BiomeClassifications.SNOWY;
|
||||||
* @param temperature the Minecraft temperature of this shore.
|
} else if (temperature <= 0.3f) {
|
||||||
* @return the shore biome associated with it.
|
return BiomeClassifications.COLD;
|
||||||
*/
|
} else if (temperature <= 1f) {
|
||||||
public Biome getShoreBiome(Biome from, float temperature) {
|
return BiomeClassifications.LUSH;
|
||||||
String biomeName = from.name().toLowerCase();
|
|
||||||
if (biomeName.contains("mushroom")) {
|
|
||||||
return Biome.MUSHROOM_FIELD_SHORE;
|
|
||||||
} else if (biomeName.contains("mountains")) {
|
|
||||||
return Biome.STONE_SHORE;
|
|
||||||
}
|
|
||||||
if (temperature < 0.05) {
|
|
||||||
return Biome.SNOWY_BEACH;
|
|
||||||
}
|
|
||||||
return Biome.BEACH;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOceanBiome(Biome biome) {
|
|
||||||
return oceanBiomeTemperatures.containsKey(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLandBiome(Biome biome) {
|
|
||||||
return !isOceanBiome(biome);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Randomly selects a land biome that fits in given temperature.
|
|
||||||
* @param temperature Minecraft temperature to select biome from.
|
|
||||||
* @param seed The seed to use to select the biome.
|
|
||||||
* @return The randomly selected biome.
|
|
||||||
*/
|
|
||||||
public Biome getLandBiome(float temperature, int worldX, int worldZ) {
|
|
||||||
ArrayList<Biome> biomes = null;
|
|
||||||
if (temperature <= 0.05f) {
|
|
||||||
biomes = temperaturePartitionedLandBiomes.get(0.05f);
|
|
||||||
} else if (temperature <= 0.3) {
|
|
||||||
biomes = temperaturePartitionedLandBiomes.get(0.3f);
|
|
||||||
} else if (temperature <= 0.85f) {
|
|
||||||
biomes = temperaturePartitionedLandBiomes.get(0.95f);
|
|
||||||
} else {
|
} else {
|
||||||
biomes = temperaturePartitionedLandBiomes.get(2.00f);
|
return BiomeClassifications.WARM;
|
||||||
}
|
}
|
||||||
return biomes.get((int) ((noise.noise(worldX, worldZ, 0.5d, 0.5d, true) + 1d) / 2d) * biomes.size());
|
}
|
||||||
|
|
||||||
|
public LandBiomeInfo getLandBiomeInfo(float temperature, int worldX, int worldZ) {
|
||||||
|
return getClassification(temperature).getSelector().selectRandom((float) noise.noise(worldX, worldZ, 0.5d, 0.5d, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -347,18 +65,9 @@ public class BiomeMap {
|
|||||||
* @param seed The seed to use to select the biome.
|
* @param seed The seed to use to select the biome.
|
||||||
* @return The randomly selected biome.
|
* @return The randomly selected biome.
|
||||||
*/
|
*/
|
||||||
public Biome getOceanBiome(float temperature, boolean isDeep, int worldX, int worldZ) {
|
public OceanBiomeInfo getOceanBiome(float temperature) {
|
||||||
ArrayList<Biome> biomes = null;
|
BiomeClassifications classification = getClassification(temperature);
|
||||||
if (temperature <= 0.00f) {
|
return classification.getAssociatedOceanBiomeInfo();
|
||||||
biomes = temperaturePartitionedOceanBiomes.get(0.0f);
|
|
||||||
} else if (temperature <= 0.3) {
|
|
||||||
biomes = temperaturePartitionedOceanBiomes.get(0.3f);
|
|
||||||
} else {
|
|
||||||
biomes = temperaturePartitionedOceanBiomes.get(0.5f);
|
|
||||||
}
|
|
||||||
Biome oceanBiome = biomes.get((int) ((noise.noise(worldX, worldZ, 0.5d, 0.5d, true) + 1d) / 2d) * biomes.size());
|
|
||||||
if (isDeep) oceanBiome = Biome.valueOf("DEEP_" + oceanBiome.name());
|
|
||||||
return oceanBiome;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -20,9 +20,8 @@ public class IslandWorldMap {
|
|||||||
private final double NOISE_FREQ = 1.78D;
|
private final double NOISE_FREQ = 1.78D;
|
||||||
private final double NOISE_AMP = 0.47D;
|
private final double NOISE_AMP = 0.47D;
|
||||||
private final float SHORE_PORTION = 0.095f;
|
private final float SHORE_PORTION = 0.095f;
|
||||||
private final float SHALLOW_PORTION = 0.07f;
|
private final float SHALLOW_PORTION = 0.06f;
|
||||||
private final double SCALE = 0.005D;
|
private final double SCALE = 0.005D;
|
||||||
private final double DEEP_OCEAN_PORTION = 0.6d;
|
|
||||||
private final DepthFirstSearch dfs;
|
private final DepthFirstSearch dfs;
|
||||||
|
|
||||||
public IslandWorldMap(Random random) {
|
public IslandWorldMap(Random random) {
|
||||||
@ -159,10 +158,6 @@ public class IslandWorldMap {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDeepOcean(int worldX, int worldZ) {
|
|
||||||
return getWorldValue(worldX, worldZ) <= -DEEP_OCEAN_PORTION;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the island's origin block. Will call the coordinate target validatable to end early if nessecary.
|
* Find the island's origin block. Will call the coordinate target validatable to end early if nessecary.
|
||||||
* @param worldX The x coordinate of the island block in question.
|
* @param worldX The x coordinate of the island block in question.
|
||||||
|
@ -8,12 +8,7 @@ import ca.recrown.islandsurvivalcraft.utilities.caching.Cache;
|
|||||||
import ca.recrown.islandsurvivalcraft.utilities.datatypes.Point2;
|
import ca.recrown.islandsurvivalcraft.utilities.datatypes.Point2;
|
||||||
|
|
||||||
public class TemperatureMap {
|
public class TemperatureMap {
|
||||||
public enum TemperatureRegion {
|
|
||||||
SNOWY,
|
|
||||||
COLD,
|
|
||||||
LUSH,
|
|
||||||
WARM,
|
|
||||||
}
|
|
||||||
private final Cache<Point2, Float> temperatureCache;
|
private final Cache<Point2, Float> temperatureCache;
|
||||||
private final double frequency = 0.5D;
|
private final double frequency = 0.5D;
|
||||||
private final double amplitude = 0.5D;
|
private final double amplitude = 0.5D;
|
||||||
@ -23,14 +18,14 @@ public class TemperatureMap {
|
|||||||
public TemperatureMap(Random random) {
|
public TemperatureMap(Random random) {
|
||||||
temperatureCache = new Cache<>(1024);
|
temperatureCache = new Cache<>(1024);
|
||||||
noiseGenerator = new SimplexOctaveGenerator(random, 2);
|
noiseGenerator = new SimplexOctaveGenerator(random, 2);
|
||||||
noiseGenerator.setScale(0.002D);
|
noiseGenerator.setScale(0.0009D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTemperature(int worldX, int worldZ) {
|
public float getTemperature(int worldX, int worldZ) {
|
||||||
Point2 loc = new Point2(worldX, worldZ);
|
Point2 loc = new Point2(worldX, worldZ);
|
||||||
Float val = temperatureCache.get(loc);
|
Float val = temperatureCache.get(loc);
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
val = (float) noiseGenerator.noise(worldX, worldZ, frequency, amplitude, true);
|
val = (float) (((noiseGenerator.noise(worldX, worldZ, frequency, amplitude, true) + 1D) / 2D) * 3D - 1D);
|
||||||
temperatureCache.set(loc, val);
|
temperatureCache.set(loc, val);
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package ca.recrown.islandsurvivalcraft.world.generation.biomes;
|
package ca.recrown.islandsurvivalcraft.world.generation.biomes;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
|
||||||
import ca.recrown.islandsurvivalcraft.utilities.GeneralUtilities;
|
import ca.recrown.islandsurvivalcraft.utilities.GeneralUtilities;
|
||||||
|
import ca.recrown.islandsurvivalcraft.utilities.biomes.LandBiomeInfo;
|
||||||
|
import ca.recrown.islandsurvivalcraft.utilities.biomes.OceanBiomeInfo;
|
||||||
import ca.recrown.islandsurvivalcraft.utilities.caching.Cache;
|
import ca.recrown.islandsurvivalcraft.utilities.caching.Cache;
|
||||||
import ca.recrown.islandsurvivalcraft.utilities.datatypes.Point2;
|
import ca.recrown.islandsurvivalcraft.utilities.datatypes.Point2;
|
||||||
import ca.recrown.islandsurvivalcraft.utilities.floodfill.Floodable;
|
import ca.recrown.islandsurvivalcraft.utilities.floodfill.Floodable;
|
||||||
@ -15,6 +19,9 @@ import ca.recrown.islandsurvivalcraft.world.IslandWorldMap;
|
|||||||
import ca.recrown.islandsurvivalcraft.world.TemperatureMap;
|
import ca.recrown.islandsurvivalcraft.world.TemperatureMap;
|
||||||
|
|
||||||
public class UniqueBiomeGenerator implements BiomeGenerator {
|
public class UniqueBiomeGenerator implements BiomeGenerator {
|
||||||
|
private final double DEEP_OCEAN_PORTION = 0.5d;
|
||||||
|
private final double HILL_PORTION = 0.4;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateBiomeColumn(Biome[][][] chunkBiomeSets, World world, int chunkX, int chunkZ, int localX, int localZ, IslandWorldMap islandMap, BiomeMap biomeSelector, TemperatureMap tempGen, Cache<Point2, Biome[]> biomeCache) {
|
public void generateBiomeColumn(Biome[][][] chunkBiomeSets, World world, int chunkX, int chunkZ, int localX, int localZ, IslandWorldMap islandMap, BiomeMap biomeSelector, TemperatureMap tempGen, Cache<Point2, Biome[]> biomeCache) {
|
||||||
int worldX = 16 * chunkX + localX;
|
int worldX = 16 * chunkX + localX;
|
||||||
@ -30,7 +37,8 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
//Fine, check if it's ocean.
|
//Fine, check if it's ocean.
|
||||||
if (!islandMap.isIsland(worldX, worldZ)) {
|
if (!islandMap.isIsland(worldX, worldZ)) {
|
||||||
biomeSet = chunkBiomeSets[localX][localZ];
|
biomeSet = chunkBiomeSets[localX][localZ];
|
||||||
biomeSet[0] = biomeSelector.getOceanBiome(tempGen.getTemperature(worldX, worldZ), islandMap.isDeepOcean(worldX, worldZ), worldX, worldZ);
|
OceanBiomeInfo ocean = biomeSelector.getOceanBiome(tempGen.getTemperature(worldX, worldZ));
|
||||||
|
biomeSet[0] = islandMap.getWorldValue(worldX, worldZ) >= -DEEP_OCEAN_PORTION ? ocean.getOcean() : ocean.getDeepAlternative();
|
||||||
setCacheBiome(worldX, worldZ, biomeSet, chunkBiomeSets, biomeCache);
|
setCacheBiome(worldX, worldZ, biomeSet, chunkBiomeSets, biomeCache);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -39,13 +47,16 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
IslandInfo islandInfo = new IslandInfo(islandMap, world, biomeCache);
|
IslandInfo islandInfo = new IslandInfo(islandMap, world, biomeCache);
|
||||||
Point2 islandOrigin = islandMap.findIslandOrigin(worldX, worldZ, islandInfo);
|
Point2 islandOrigin = islandMap.findIslandOrigin(worldX, worldZ, islandInfo);
|
||||||
if (!islandInfo.isComplete()) {
|
if (!islandInfo.isComplete()) {
|
||||||
float temp = tempGen.getTemperature(worldX, worldZ);
|
float temp = tempGen.getTemperature(islandOrigin.x, islandOrigin.y);
|
||||||
if (islandInfo.main == null) islandInfo.main = biomeSelector.getLandBiome(temp, islandOrigin.x, islandOrigin.y);
|
LandBiomeInfo biomeInfo = biomeSelector.getLandBiomeInfo(temp, islandOrigin.x, islandOrigin.y);
|
||||||
if (islandInfo.shore == null) islandInfo.shore = biomeSelector.getShoreBiome(islandInfo.main, temp);
|
islandInfo.biomeset = new Biome[5];
|
||||||
if (islandInfo.shallow == null) islandInfo.shallow = biomeSelector.getOceanBiome(temp, islandMap.isDeepOcean(islandOrigin.x, islandOrigin.y), islandOrigin.x, islandOrigin.y);
|
islandInfo.biomeset[1] = biomeInfo.getBiome();
|
||||||
|
islandInfo.biomeset[2] = biomeInfo.getPreferredShore() == null ? Biome.BEACH : biomeInfo.getPreferredShore();
|
||||||
|
islandInfo.biomeset[4] = biomeInfo.getHillBiome() == null ? islandInfo.biomeset[1] : biomeInfo.getHillBiome();
|
||||||
|
islandInfo.biomeset[3] = islandInfo.biomeset[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
PropagatorInfo propInfo = new PropagatorInfo(islandInfo, chunkBiomeSets, new Point2(chunkX, chunkZ), islandMap, biomeCache);
|
PropagatorInfo propInfo = new PropagatorInfo(islandInfo.biomeset, chunkBiomeSets, new Point2(chunkX, chunkZ), islandMap, biomeCache);
|
||||||
Flooder flooder = new Flooder(new Point2(worldX, worldZ), propInfo);
|
Flooder flooder = new Flooder(new Point2(worldX, worldZ), propInfo);
|
||||||
flooder.start();
|
flooder.start();
|
||||||
}
|
}
|
||||||
@ -76,7 +87,7 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
public final IslandWorldMap mapper;
|
public final IslandWorldMap mapper;
|
||||||
public final World world;
|
public final World world;
|
||||||
private final Cache<Point2, Biome[]> biomeCache;
|
private final Cache<Point2, Biome[]> biomeCache;
|
||||||
public Biome main, shore, shallow;
|
private Biome[] biomeset;
|
||||||
|
|
||||||
public IslandInfo(IslandWorldMap mapper, World world, Cache<Point2, Biome[]> biomeCache) {
|
public IslandInfo(IslandWorldMap mapper, World world, Cache<Point2, Biome[]> biomeCache) {
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
@ -86,22 +97,12 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCoordinateTarget(int x, int y) {
|
public boolean isCoordinateTarget(int x, int y) {
|
||||||
Biome[] biomeSet = attemptGetBiomeSet(world, x, y, biomeCache, null);
|
biomeset = attemptGetBiomeSet(world, x, y, biomeCache, null);
|
||||||
if (biomeSet != null) {
|
if (biomeset != null) {
|
||||||
main = biomeSet[1];
|
if (!isComplete()) throw new IllegalStateException("There was an incomplete biome set.");
|
||||||
shore = biomeSet[2];
|
return true;
|
||||||
shallow = biomeSet[3];
|
|
||||||
if ((main == null || shore == null) && mapper.isLand(x, y)) {
|
|
||||||
if (shore == null && mapper.isShore(x, y)) {
|
|
||||||
main = biomeSet[0];
|
|
||||||
} else if (main == null && !mapper.isShore(x, y)) {
|
|
||||||
shore = biomeSet[0];
|
|
||||||
}
|
}
|
||||||
} else if (shallow == null) {
|
return false;
|
||||||
shallow = biomeSet[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -110,21 +111,19 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete() {
|
public boolean isComplete() {
|
||||||
return main != null && shore != null && shallow != null;
|
return !(biomeset == null || biomeset[1] == null || biomeset[2] == null || biomeset[3] == null || biomeset[4] == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PropagatorInfo implements Floodable {
|
private class PropagatorInfo implements Floodable {
|
||||||
private final Biome shallow, shore, main;
|
private final Biome[] biomeset;
|
||||||
private final Biome[][][] biomes;
|
private final Biome[][][] biomes;
|
||||||
private final Point2 chunkCoords;
|
private final Point2 chunkCoords;
|
||||||
private final IslandWorldMap mapper;
|
private final IslandWorldMap mapper;
|
||||||
private final Cache<Point2, Biome[]> biomeCache;
|
private final Cache<Point2, Biome[]> biomeCache;
|
||||||
|
|
||||||
public PropagatorInfo(IslandInfo islandInfo, Biome[][][] biomes, Point2 chunkCoords, IslandWorldMap mapper, Cache<Point2, Biome[]> biomeCache) {
|
public PropagatorInfo(Biome[] biomeset, Biome[][][] biomes, Point2 chunkCoords, IslandWorldMap mapper, Cache<Point2, Biome[]> biomeCache) {
|
||||||
this.shallow = islandInfo.shallow;
|
this.biomeset = biomeset;
|
||||||
this.shore = islandInfo.shore;
|
|
||||||
this.main = islandInfo.main;
|
|
||||||
this.biomes = biomes;
|
this.biomes = biomes;
|
||||||
this.chunkCoords = chunkCoords;
|
this.chunkCoords = chunkCoords;
|
||||||
this.mapper = mapper;
|
this.mapper = mapper;
|
||||||
@ -137,18 +136,17 @@ public class UniqueBiomeGenerator implements BiomeGenerator {
|
|||||||
if (!this.chunkCoords.fastEquals(chunkCoords) || !mapper.isIsland(point.x, point.y)) return false;
|
if (!this.chunkCoords.fastEquals(chunkCoords) || !mapper.isIsland(point.x, point.y)) return false;
|
||||||
int x = point.x;
|
int x = point.x;
|
||||||
int y = point.y;
|
int y = point.y;
|
||||||
Biome[] biomeSet = new Biome[4];
|
Biome[] biomeSet = Arrays.copyOf(biomeset, biomeset.length);
|
||||||
biomeSet[1] = main;
|
|
||||||
biomeSet[2] = shore;
|
|
||||||
biomeSet[3] = shallow;
|
|
||||||
if (mapper.isLand(x, y)) {
|
if (mapper.isLand(x, y)) {
|
||||||
if (mapper.isShore(x, y)) {
|
if (mapper.isShore(x, y)) {
|
||||||
biomeSet[0] = shore;
|
biomeSet[0] = biomeset[2];
|
||||||
|
} else if (mapper.getWorldValue(x, y) >= HILL_PORTION) {
|
||||||
|
biomeSet[0] = biomeset[4];
|
||||||
} else {
|
} else {
|
||||||
biomeSet[0] = main;
|
biomeSet[0] = biomeset[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
biomeSet[0] = shallow;
|
biomeSet[0] = biomeset[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
setCacheBiome(x, y, biomeSet, biomes, biomeCache);
|
setCacheBiome(x, y, biomeSet, biomes, biomeCache);
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package ca.recrown.islandsurvivalcraft.world.generation.chunks;
|
package ca.recrown.islandsurvivalcraft.world.generation.chunks;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
@ -40,8 +38,7 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
private volatile WorldHeightShader heightShader;
|
private volatile WorldHeightShader heightShader;
|
||||||
private volatile WorldLayerShader layerShader;
|
private volatile WorldLayerShader layerShader;
|
||||||
private volatile Cache<Point2, Biome[]> biomeCache = new Cache<>(131072);
|
private volatile Cache<Point2, Biome[]> biomeCache = new Cache<>(131072);
|
||||||
private volatile ExecutorService exAlpha = GeneralUtilities.ISC_EXECUTOR_ALPHA;
|
private final ExecutorService exAlpha = GeneralUtilities.ISC_EXECUTOR_ALPHA;
|
||||||
private volatile ExecutorService exBeta = GeneralUtilities.ISC_EXECUTOR_BETA;
|
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if (initialized) throw new IllegalStateException("This generator has already been initialized.");
|
if (initialized) throw new IllegalStateException("This generator has already been initialized.");
|
||||||
@ -77,9 +74,6 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
worldInfo.initialize(world, this);
|
worldInfo.initialize(world, this);
|
||||||
}
|
}
|
||||||
if (!initialized) throw new IllegalStateException("This generator has not been initialized.");
|
if (!initialized) throw new IllegalStateException("This generator has not been initialized.");
|
||||||
|
|
||||||
LinkedList<Future<Boolean>> tasks = new LinkedList<>();
|
|
||||||
ChunkData chunkData = createChunkData(world);
|
|
||||||
Future<Boolean> preLoader = exAlpha.submit(() -> {
|
Future<Boolean> preLoader = exAlpha.submit(() -> {
|
||||||
for (int x = GeneralUtilities.CHUNK_SIZE - 1; x >= 0; x--) {
|
for (int x = GeneralUtilities.CHUNK_SIZE - 1; x >= 0; x--) {
|
||||||
for (int z = GeneralUtilities.CHUNK_SIZE - 1; z >= 0; z--) {
|
for (int z = GeneralUtilities.CHUNK_SIZE - 1; z >= 0; z--) {
|
||||||
@ -90,7 +84,9 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
Biome[][][] biomeArraySet = new Biome[GeneralUtilities.CHUNK_SIZE][GeneralUtilities.CHUNK_SIZE][4];
|
ChunkData chunkData = createChunkData(world);
|
||||||
|
|
||||||
|
Biome[][][] biomeArraySet = new Biome[GeneralUtilities.CHUNK_SIZE][GeneralUtilities.CHUNK_SIZE][5];
|
||||||
for (int x = 0; x < GeneralUtilities.CHUNK_SIZE; x++) {
|
for (int x = 0; x < GeneralUtilities.CHUNK_SIZE; x++) {
|
||||||
for (int z = 0; z < GeneralUtilities.CHUNK_SIZE; z++) {
|
for (int z = 0; z < GeneralUtilities.CHUNK_SIZE; z++) {
|
||||||
final int localX = x;
|
final int localX = x;
|
||||||
@ -101,13 +97,10 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
biomeGenerator.generateBiomeColumn(biomeArraySet, world, chunkX, chunkZ, localX, localZ, islandMap, biomeMap,
|
biomeGenerator.generateBiomeColumn(biomeArraySet, world, chunkX, chunkZ, localX, localZ, islandMap, biomeMap,
|
||||||
temperatureMap, biomeCache);
|
temperatureMap, biomeCache);
|
||||||
}
|
}
|
||||||
if (biomeArraySet[localX][localZ][0] == null) throw new IllegalStateException("Biome was null.");
|
|
||||||
tasks.add(exBeta.submit(() -> {
|
|
||||||
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
for (int y = 0; y < worldInfo.getWorldHeight(); y++) {
|
||||||
biomeGrid.setBiome(localX, y, localZ, biomeArraySet[localX][localZ][0]);
|
biomeGrid.setBiome(localX, y, localZ, biomeArraySet[localX][localZ][0]);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}));
|
|
||||||
|
|
||||||
Biome[] currentBiomeSet = biomeArraySet[localX][localZ];
|
Biome[] currentBiomeSet = biomeArraySet[localX][localZ];
|
||||||
int terrainHeight = heightShader.getTerrainHeight(worldX, worldZ, currentBiomeSet);
|
int terrainHeight = heightShader.getTerrainHeight(worldX, worldZ, currentBiomeSet);
|
||||||
@ -135,16 +128,7 @@ public class IslandWorldChunkGenerator extends ChunkGenerator implements Listene
|
|||||||
chunkData.setRegion(localX, 0, localZ, localX + 1, bedrockHeight, localZ + 1, Material.BEDROCK);
|
chunkData.setRegion(localX, 0, localZ, localX + 1, bedrockHeight, localZ + 1, Material.BEDROCK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
preLoader.cancel(false);
|
preLoader.cancel(false);
|
||||||
try {
|
|
||||||
while (!tasks.isEmpty()) {
|
|
||||||
tasks.poll().get();
|
|
||||||
}
|
|
||||||
} catch (ExecutionException | InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new IllegalStateException(e.getCause().getMessage());
|
|
||||||
}
|
|
||||||
return chunkData;
|
return chunkData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,15 @@ public class WorldHeightShader {
|
|||||||
int height = 0;
|
int height = 0;
|
||||||
String biomeName = biomeSet[0].name().toLowerCase();
|
String biomeName = biomeSet[0].name().toLowerCase();
|
||||||
if (!mapper.isLand(worldX, worldZ)) {
|
if (!mapper.isLand(worldX, worldZ)) {
|
||||||
height = (int) calculateTerrainFactor(worldX, worldZ, seaLevel * 0.8d, 1.7d, 0.5d, 1d, 0.1d);
|
height = (int) Math.floor(calculateTerrainFactor(worldX, worldZ, seaLevel * 0.8d, 1.7d, 0.5d, 1d, 0.09d));
|
||||||
} else if (biomeName.contains("beach")) {
|
} else if (biomeName.contains("beach")) {
|
||||||
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 10d));
|
if (biomeSet[1].name().toLowerCase().contains("mountains")) {
|
||||||
|
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], -15d));
|
||||||
|
} else {
|
||||||
|
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], 0d));
|
||||||
|
}
|
||||||
} else if (biomeName.contains("shore")) {
|
} else if (biomeName.contains("shore")) {
|
||||||
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], -30d));
|
height = (int) (getIslandBiomeHeight(worldX, worldZ, biomeSet[1], -15d));
|
||||||
} else {
|
} else {
|
||||||
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0], 0d) + 1;
|
height = getIslandBiomeHeight(worldX, worldZ, biomeSet[0], 0d) + 1;
|
||||||
}
|
}
|
||||||
@ -44,10 +48,8 @@ public class WorldHeightShader {
|
|||||||
private int getIslandBiomeHeight(int worldX, int worldZ, Biome biome, double heightModifier) {
|
private int getIslandBiomeHeight(int worldX, int worldZ, Biome biome, double heightModifier) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
String biomeName = biome.name().toLowerCase();
|
String biomeName = biome.name().toLowerCase();
|
||||||
if (biomeName.contains("hills")) {
|
if (biomeName.contains("mountains")) {
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 60d + heightModifier, 1.5d, 0.5d);
|
res = (int) calculateTerrainFactor(worldX, worldZ, 180d + heightModifier, 1.88d, 0.5d);
|
||||||
} else if (biomeName.contains("mountains")) {
|
|
||||||
res = (int) calculateTerrainFactor(worldX, worldZ, 200d + heightModifier, 1.8d, 0.5d);
|
|
||||||
} else if (biomeName.contains("plateau")) {
|
} else if (biomeName.contains("plateau")) {
|
||||||
res = (int) Math.min(calculateTerrainFactor(worldX, worldZ, 60d + heightModifier), seaLevel + 30d);
|
res = (int) Math.min(calculateTerrainFactor(worldX, worldZ, 60d + heightModifier), seaLevel + 30d);
|
||||||
} else if (biomeName.contains("modified")) {
|
} else if (biomeName.contains("modified")) {
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
package ca.recrown.islandsurvivalcraft.world;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
import org.junit.jupiter.api.TestInstance;
|
|
||||||
import org.junit.jupiter.api.TestInstance.Lifecycle;
|
|
||||||
|
|
||||||
@TestInstance(Lifecycle.PER_CLASS)
|
|
||||||
public class BiomeMapTest {
|
|
||||||
private final Random random = new Random(10320452);
|
|
||||||
BiomeMap biomeSelector;
|
|
||||||
|
|
||||||
@BeforeAll
|
|
||||||
public void setUp() {
|
|
||||||
biomeSelector = new BiomeMap(random);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetBiomeTemperatureBirchHill() {
|
|
||||||
assertEquals(0.6f, biomeSelector.getBiomeTemperature(Biome.BIRCH_FOREST_HILLS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetBiomeTemperatureSwampHill() {
|
|
||||||
assertEquals(0.8f, biomeSelector.getBiomeTemperature(Biome.SWAMP_HILLS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetBiomeTemperatureTaigaHill() {
|
|
||||||
assertEquals(0.25f, biomeSelector.getBiomeTemperature(Biome.TAIGA_HILLS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetBiomeTemperatureSnowyTaigaHill() {
|
|
||||||
assertEquals(-0.5f, biomeSelector.getBiomeTemperature(Biome.SNOWY_TAIGA_HILLS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetBiomeTemperatureSnowyTaigaMountain() {
|
|
||||||
assertEquals(-0.5f, biomeSelector.getBiomeTemperature(Biome.SNOWY_TAIGA_MOUNTAINS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetTransitionalBiomeFromModifiedJungle() {
|
|
||||||
assertEquals(Biome.MODIFIED_JUNGLE_EDGE, biomeSelector.getTransitionalBiome(Biome.MODIFIED_JUNGLE));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetTransitionalBiomeFromOcean() {
|
|
||||||
assertEquals(null, biomeSelector.getTransitionalBiome(Biome.OCEAN));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetTransitionalBiomeFromMountain() {
|
|
||||||
assertEquals(null, biomeSelector.getTransitionalBiome(Biome.MOUNTAINS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetTransitionalBiomeFromJungle() {
|
|
||||||
assertEquals(Biome.JUNGLE_EDGE, biomeSelector.getTransitionalBiome(Biome.JUNGLE));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetShoreBiomeFromMountain() {
|
|
||||||
assertEquals(Biome.STONE_SHORE, biomeSelector.getShoreBiome(Biome.MOUNTAINS, 0.2f));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetShoreBiomeFromMushroomIsland() {
|
|
||||||
assertEquals(Biome.MUSHROOM_FIELD_SHORE, biomeSelector.getShoreBiome(Biome.MUSHROOM_FIELDS, 1.2f));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetShoreBiomeFromPlains() {
|
|
||||||
assertEquals(Biome.BEACH, biomeSelector.getShoreBiome(Biome.PLAINS, 0.8f));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetShoreBiomeFromSnowyTaiga() {
|
|
||||||
assertEquals(Biome.SNOWY_BEACH, biomeSelector.getShoreBiome(Biome.SNOWY_TAIGA, -0.5f));
|
|
||||||
}
|
|
||||||
}
|
|
@ -60,7 +60,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
|
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,7 +71,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
public void setMetadata(String metadataKey, MetadataValue newMetadataValue) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -90,7 +88,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -228,7 +225,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void loadChunk(Chunk chunk) {
|
public void loadChunk(Chunk chunk) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -252,7 +248,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void loadChunk(int x, int z) {
|
public void loadChunk(int x, int z) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -306,7 +301,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setChunkForceLoaded(int x, int z, boolean forced) {
|
public void setChunkForceLoaded(int x, int z, boolean forced) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -330,7 +324,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void removePluginChunkTickets(Plugin plugin) {
|
public void removePluginChunkTickets(Plugin plugin) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -364,8 +357,8 @@ public class DummyWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends AbstractArrow> T spawnArrow(Location location, Vector direction,
|
public <T extends AbstractArrow> T spawnArrow(Location location, Vector direction, float speed, float spread,
|
||||||
float speed, float spread, Class<T> clazz) {
|
Class<T> clazz) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -463,57 +456,53 @@ public class DummyWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Entity> getNearbyEntities(BoundingBox boundingBox,
|
public Collection<Entity> getNearbyEntities(BoundingBox boundingBox, Predicate<Entity> filter) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance,
|
||||||
Predicate<Entity> filter) {
|
Predicate<Entity> filter) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTraceEntities(Location start, Vector direction,
|
public RayTraceResult rayTraceEntities(Location start, Vector direction, double maxDistance, double raySize,
|
||||||
double maxDistance) {
|
Predicate<Entity> filter) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTraceEntities(Location start, Vector direction,
|
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance) {
|
||||||
double maxDistance, double raySize) {
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTraceEntities(Location start, Vector direction,
|
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance,
|
||||||
double maxDistance, Predicate<Entity> filter) {
|
FluidCollisionMode fluidCollisionMode) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RayTraceResult rayTraceEntities(Location start, Vector direction,
|
public RayTraceResult rayTraceBlocks(Location start, Vector direction, double maxDistance,
|
||||||
double maxDistance, double raySize, Predicate<Entity> filter) {
|
FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction,
|
|
||||||
double maxDistance) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction,
|
|
||||||
double maxDistance, FluidCollisionMode fluidCollisionMode) {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RayTraceResult rayTraceBlocks(Location start, Vector direction,
|
|
||||||
double maxDistance, FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks) {
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -544,12 +533,6 @@ public class DummyWorld implements World {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setSpawnLocation(Location location) {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setSpawnLocation(int x, int y, int z) {
|
public boolean setSpawnLocation(int x, int y, int z) {
|
||||||
|
|
||||||
@ -565,7 +548,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setTime(long time) {
|
public void setTime(long time) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -577,7 +559,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setFullTime(long time) {
|
public void setFullTime(long time) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -595,7 +576,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setStorm(boolean hasStorm) {
|
public void setStorm(boolean hasStorm) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -607,7 +587,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setWeatherDuration(int duration) {
|
public void setWeatherDuration(int duration) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -619,7 +598,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setThundering(boolean thundering) {
|
public void setThundering(boolean thundering) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -631,7 +609,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setThunderDuration(int duration) {
|
public void setThunderDuration(int duration) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -672,8 +649,7 @@ public class DummyWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createExplosion(Entity source, Location loc, float power, boolean setFire,
|
public boolean createExplosion(Entity source, Location loc, float power, boolean setFire, boolean breakBlocks) {
|
||||||
boolean breakBlocks) {
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -685,8 +661,7 @@ public class DummyWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean createExplosion(Location loc, float power, boolean setFire, boolean breakBlocks,
|
public boolean createExplosion(Location loc, float power, boolean setFire, boolean breakBlocks, Entity source) {
|
||||||
Entity source) {
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -712,7 +687,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setPVP(boolean pvp) {
|
public void setPVP(boolean pvp) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -724,7 +698,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void save() {
|
public void save() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -734,29 +707,26 @@ public class DummyWorld implements World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> T spawn(Location location, Class<T> clazz)
|
public <T extends Entity> T spawn(Location location, Class<T> clazz) throws IllegalArgumentException {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T extends Entity> T spawn(Location location, Class<T> clazz, Consumer<T> function)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T extends Entity> T spawn(Location location, Class<T> clazz,
|
public FallingBlock spawnFallingBlock(Location location, MaterialData data) throws IllegalArgumentException {
|
||||||
Consumer<T> function) throws IllegalArgumentException {
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FallingBlock spawnFallingBlock(Location location, MaterialData data)
|
public FallingBlock spawnFallingBlock(Location location, BlockData data) throws IllegalArgumentException {
|
||||||
throws IllegalArgumentException {
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FallingBlock spawnFallingBlock(Location location, BlockData data)
|
|
||||||
throws IllegalArgumentException {
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -771,25 +741,21 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void playEffect(Location location, Effect effect, int data) {
|
public void playEffect(Location location, Effect effect, int data) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playEffect(Location location, Effect effect, int data, int radius) {
|
public void playEffect(Location location, Effect effect, int data, int radius) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void playEffect(Location location, Effect effect, T data) {
|
public <T> void playEffect(Location location, Effect effect, T data) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void playEffect(Location location, Effect effect, T data, int radius) {
|
public <T> void playEffect(Location location, Effect effect, T data, int radius) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -801,7 +767,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) {
|
public void setSpawnFlags(boolean allowMonsters, boolean allowAnimals) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -831,13 +796,11 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setBiome(int x, int z, Biome bio) {
|
public void setBiome(int x, int z, Biome bio) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBiome(int x, int y, int z, Biome bio) {
|
public void setBiome(int x, int y, int z, Biome bio) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -885,7 +848,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
public void setKeepSpawnInMemory(boolean keepLoaded) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -897,13 +859,11 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setAutoSave(boolean value) {
|
public void setAutoSave(boolean value) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDifficulty(Difficulty difficulty) {
|
public void setDifficulty(Difficulty difficulty) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -939,7 +899,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setHardcore(boolean hardcore) {
|
public void setHardcore(boolean hardcore) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -951,7 +910,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
public void setTicksPerAnimalSpawns(int ticksPerAnimalSpawns) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -963,7 +921,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
public void setTicksPerMonsterSpawns(int ticksPerMonsterSpawns) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -975,7 +932,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) {
|
public void setTicksPerWaterSpawns(int ticksPerWaterSpawns) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -987,7 +943,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) {
|
public void setTicksPerAmbientSpawns(int ticksPerAmbientSpawns) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -999,7 +954,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setMonsterSpawnLimit(int limit) {
|
public void setMonsterSpawnLimit(int limit) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1011,7 +965,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setAnimalSpawnLimit(int limit) {
|
public void setAnimalSpawnLimit(int limit) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1023,7 +976,6 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setWaterAnimalSpawnLimit(int limit) {
|
public void setWaterAnimalSpawnLimit(int limit) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1035,32 +987,25 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void setAmbientSpawnLimit(int limit) {
|
public void setAmbientSpawnLimit(int limit) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(Location location, Sound sound, float volume, float pitch) {
|
public void playSound(Location location, Sound sound, float volume, float pitch) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(Location location, String sound, float volume, float pitch) {
|
public void playSound(Location location, String sound, float volume, float pitch) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSound(Location location, Sound sound, SoundCategory category,
|
public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch) {
|
||||||
float volume, float pitch) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void playSound(Location location, String sound, SoundCategory category,
|
|
||||||
float volume, float pitch) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,32 +1060,26 @@ public class DummyWorld implements World {
|
|||||||
@Override
|
@Override
|
||||||
public void spawnParticle(Particle particle, Location location, int count) {
|
public void spawnParticle(Particle particle, Location location, int count) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void spawnParticle(Particle particle, double x, double y, double z, int count) {
|
public void spawnParticle(Particle particle, double x, double y, double z, int count) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(Particle particle, Location location, int count, T data) {
|
public <T> void spawnParticle(Particle particle, Location location, int count, T data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count,
|
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||||
T data) {
|
double offsetZ) {
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void spawnParticle(Particle particle, Location location, int count, double offsetX,
|
|
||||||
double offsetY, double offsetZ) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1148,13 +1087,11 @@ public class DummyWorld implements World {
|
|||||||
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||||
double offsetY, double offsetZ) {
|
double offsetY, double offsetZ) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX,
|
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||||
double offsetY, double offsetZ, T data) {
|
double offsetZ, T data) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1162,13 +1099,11 @@ public class DummyWorld implements World {
|
|||||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||||
double offsetY, double offsetZ, T data) {
|
double offsetY, double offsetZ, T data) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void spawnParticle(Particle particle, Location location, int count, double offsetX,
|
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||||
double offsetY, double offsetZ, double extra) {
|
double offsetZ, double extra) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1176,28 +1111,23 @@ public class DummyWorld implements World {
|
|||||||
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||||
double offsetY, double offsetZ, double extra) {
|
double offsetY, double offsetZ, double extra) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||||
|
double offsetZ, double extra, T data) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX,
|
public <T> void spawnParticle(Particle particle, List<Player> receivers, Player source, double x, double y,
|
||||||
double offsetY, double offsetZ, double extra, T data) {
|
double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> void spawnParticle(Particle particle, List<Player> receivers, Player source,
|
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
|
||||||
double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra,
|
double offsetZ, double extra, T data, boolean force) {
|
||||||
T data, boolean force) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX,
|
|
||||||
double offsetY, double offsetZ, double extra, T data, boolean force) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,12 +1135,11 @@ public class DummyWorld implements World {
|
|||||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
|
||||||
double offsetY, double offsetZ, double extra, T data, boolean force) {
|
double offsetY, double offsetZ, double extra, T data, boolean force) {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location locateNearestStructure(Location origin, StructureType structureType,
|
public Location locateNearestStructure(Location origin, StructureType structureType, int radius,
|
||||||
int radius, boolean findUnexplored) {
|
boolean findUnexplored) {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -1245,4 +1174,22 @@ public class DummyWorld implements World {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNoTickViewDistance() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNoTickViewDistance(int arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setSpawnLocation(Location location) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setViewDistance(int arg0) {
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user