mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-17 13:49:57 +00:00
Add advanced biome blending
This commit is contained in:
@@ -10,6 +10,7 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.biome.Biome;
|
||||
import org.polydev.gaea.generation.GenerationPhase;
|
||||
import org.polydev.gaea.population.GaeaBlockPopulator;
|
||||
import org.polydev.gaea.profiler.ProfileFuture;
|
||||
import org.polydev.gaea.world.Flora;
|
||||
@@ -27,7 +28,7 @@ public class FloraPopulator extends GaeaBlockPopulator {
|
||||
pop.add(chunk);
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int z = 0; z < 16; z++) {
|
||||
UserDefinedBiome biome = (UserDefinedBiome) TerraBiomeGrid.fromWorld(world).getBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z);
|
||||
UserDefinedBiome biome = (UserDefinedBiome) TerraBiomeGrid.fromWorld(world).getBiome((chunk.getX() << 4) + x, (chunk.getZ() << 4) + z, GenerationPhase.POPULATE);
|
||||
if(biome.getDecorator().getFloraChance() <= 0 || random.nextInt(100) > biome.getDecorator().getFloraChance())
|
||||
continue;
|
||||
try {
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.biome.Biome;
|
||||
import org.polydev.gaea.generation.GenerationPhase;
|
||||
import org.polydev.gaea.population.GaeaBlockPopulator;
|
||||
import org.polydev.gaea.profiler.ProfileFuture;
|
||||
|
||||
@@ -22,7 +23,7 @@ public class OrePopulator extends GaeaBlockPopulator {
|
||||
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
|
||||
try (ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("OreTime")) {
|
||||
Location l = chunk.getBlock(8, 0, 0).getLocation();
|
||||
Biome b = TerraBiomeGrid.fromWorld(world).getBiome(l.getBlockX(), l.getBlockZ());
|
||||
Biome b = TerraBiomeGrid.fromWorld(world).getBiome(l.getBlockX(), l.getBlockZ(), GenerationPhase.POPULATE);
|
||||
for(Map.Entry<OreConfig, Range> e : BiomeConfig.fromBiome((UserDefinedBiome) b).getOres().entrySet()) {
|
||||
int num = e.getValue().get(random);
|
||||
for(int i = 0; i < num; i++) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.polydev.gaea.biome.Biome;
|
||||
import org.polydev.gaea.generation.GenerationPhase;
|
||||
import org.polydev.gaea.population.GaeaBlockPopulator;
|
||||
import org.polydev.gaea.profiler.ProfileFuture;
|
||||
import org.polydev.gaea.util.WorldUtil;
|
||||
@@ -22,14 +23,14 @@ public class TreePopulator extends GaeaBlockPopulator {
|
||||
int x = random.nextInt(16); // Decrease chances of chunk-crossing trees
|
||||
int z = random.nextInt(16);
|
||||
Location origin = chunk.getBlock(x, 0, z).getLocation();
|
||||
Biome b = TerraBiomeGrid.fromWorld(world).getBiome(origin);
|
||||
Biome b = TerraBiomeGrid.fromWorld(world).getBiome(origin, GenerationPhase.POPULATE);
|
||||
if(((UserDefinedDecorator) b.getDecorator()).getTreeChance() < random.nextInt(100)) return;
|
||||
int numTrees = 0;
|
||||
for(int i = 0; i < 48; i++) {
|
||||
int y = WorldUtil.getHighestValidSpawnAt(chunk, x, z);
|
||||
if(y <= 0) continue;
|
||||
origin = chunk.getBlock(x, y, z).getLocation().add(0, 1, 0);
|
||||
b = TerraBiomeGrid.fromWorld(world).getBiome(origin);
|
||||
b = TerraBiomeGrid.fromWorld(world).getBiome(origin, GenerationPhase.POPULATE);
|
||||
numTrees++;
|
||||
try {
|
||||
b.getDecorator().getTrees().get(random).plant(origin, random, false, Terra.getInstance());
|
||||
|
||||
Reference in New Issue
Block a user