Implement multiple failover types

This commit is contained in:
dfsek
2020-10-08 16:59:03 -07:00
parent 3ca1c5980c
commit 1a7d49ab1e
20 changed files with 160 additions and 9 deletions

View File

@@ -31,7 +31,9 @@ public class CavePopulator extends BlockPopulator {
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
if(ConfigUtil.masterDisableCaves) return;
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("CaveTime")) {
ConfigPack config = TerraWorld.getWorld(world).getConfig();
TerraWorld tw = TerraWorld.getWorld(world);
if(!tw.isSafe()) return;
ConfigPack config = tw.getConfig();
for(CarverConfig c : config.getCarvers().values()) {
Map<Location, Material> shiftCandidate = new HashMap<>();

View File

@@ -23,6 +23,7 @@ public class FloraPopulator extends GaeaBlockPopulator {
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
try (ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("FloraTime")) {
TerraWorld tw = TerraWorld.getWorld(world);
if(!tw.isSafe()) return;
TerraBiomeGrid grid = tw.getGrid();
ConfigPack config = tw.getConfig();
for(int x = 0; x < 16; x++) {

View File

@@ -21,7 +21,9 @@ public class OrePopulator extends GaeaBlockPopulator {
@Override
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
try (ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("OreTime")) {
ConfigPack config = TerraWorld.getWorld(world).getConfig();
TerraWorld tw = TerraWorld.getWorld(world);
if(!tw.isSafe()) return;
ConfigPack config = tw.getConfig();
Biome b = TerraWorld.getWorld(world).getGrid().getBiome((chunk.getX() << 4)+8, (chunk.getZ() << 4) + 8, GenerationPhase.POPULATE);
for(Map.Entry<OreConfig, Range> e : config.getBiome((UserDefinedBiome) b).getOres().getOres().entrySet()) {
int num = e.getValue().get(random);

View File

@@ -3,6 +3,7 @@ package com.dfsek.terra.population;
import com.dfsek.terra.TerraWorld;
import com.dfsek.terra.biome.TerraBiomeGrid;
import com.dfsek.terra.biome.UserDefinedBiome;
import com.dfsek.terra.config.base.ConfigPack;
import com.dfsek.terra.config.base.ConfigUtil;
import com.dfsek.terra.util.DataUtil;
import org.bukkit.Bukkit;
@@ -45,6 +46,7 @@ public class SnowPopulator extends GaeaBlockPopulator {
int origX = chunk.getX() << 4;
int origZ = chunk.getZ() << 4;
TerraWorld w = TerraWorld.getWorld(world);
if(!w.isSafe()) return;
TerraBiomeGrid g = w.getGrid();
for(int x = 0; x < 16; x++) {
for(int z = 0; z < 16; z++) {

View File

@@ -27,6 +27,7 @@ public class StructurePopulator extends BlockPopulator {
int cx = (chunk.getX() << 4);
int cz = (chunk.getZ() << 4);
TerraWorld tw = TerraWorld.getWorld(world);
if(!tw.isSafe()) return;
TerraBiomeGrid grid = tw.getGrid();
ConfigPack config = tw.getConfig();
UserDefinedBiome b = (UserDefinedBiome) grid.getBiome(cx+ 8, cz + 8, GenerationPhase.POPULATE);

View File

@@ -5,6 +5,7 @@ import com.dfsek.terra.TerraProfiler;
import com.dfsek.terra.TerraWorld;
import com.dfsek.terra.biome.TerraBiomeGrid;
import com.dfsek.terra.biome.UserDefinedBiome;
import com.dfsek.terra.config.base.ConfigPack;
import com.dfsek.terra.config.base.WorldConfig;
import com.dfsek.terra.generation.UserDefinedDecorator;
import org.bukkit.Chunk;
@@ -29,6 +30,7 @@ public class TreePopulator extends GaeaBlockPopulator {
public void populate(@NotNull World world, @NotNull Random random, @NotNull Chunk chunk) {
try(ProfileFuture ignored = TerraProfiler.fromWorld(world).measure("TreeGenTime")) {
TerraWorld tw = TerraWorld.getWorld(world);
if(!tw.isSafe()) return;
TerraBiomeGrid grid = tw.getGrid();;
int x = random.nextInt(16);
int z = random.nextInt(16);