mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-17 14:21:08 +00:00
Add options to disable default populators
This commit is contained in:
@@ -73,6 +73,46 @@ public class ConfigPackTemplate implements ConfigTemplate {
|
|||||||
@Default
|
@Default
|
||||||
private String version = "0.1.0";
|
private String version = "0.1.0";
|
||||||
|
|
||||||
|
@Value("disable.carvers")
|
||||||
|
@Default
|
||||||
|
private boolean disableCarvers = false;
|
||||||
|
|
||||||
|
@Value("disable.structures")
|
||||||
|
@Default
|
||||||
|
private boolean disableStructures = false;
|
||||||
|
|
||||||
|
@Value("disable.ores")
|
||||||
|
@Default
|
||||||
|
private boolean disableOres = false;
|
||||||
|
|
||||||
|
@Value("disable.trees")
|
||||||
|
@Default
|
||||||
|
private boolean disableTrees = false;
|
||||||
|
|
||||||
|
@Value("disable.flora")
|
||||||
|
@Default
|
||||||
|
private boolean disableFlora = false;
|
||||||
|
|
||||||
|
public boolean disableCarvers() {
|
||||||
|
return disableCarvers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean disableFlora() {
|
||||||
|
return disableFlora;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean disableOres() {
|
||||||
|
return disableOres;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean disableStructures() {
|
||||||
|
return disableStructures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean disableTrees() {
|
||||||
|
return disableTrees;
|
||||||
|
}
|
||||||
|
|
||||||
public LinkedHashMap<String, FunctionTemplate> getFunctions() {
|
public LinkedHashMap<String, FunctionTemplate> getFunctions() {
|
||||||
return functions;
|
return functions;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public class CavePopulator implements TerraBlockPopulator, Chunkified {
|
|||||||
Random random = PopulationUtil.getRandom(chunk);
|
Random random = PopulationUtil.getRandom(chunk);
|
||||||
if(!tw.isSafe()) return;
|
if(!tw.isSafe()) return;
|
||||||
WorldConfig config = tw.getConfig();
|
WorldConfig config = tw.getConfig();
|
||||||
|
if(config.getTemplate().disableCarvers()) return;
|
||||||
|
|
||||||
for(UserDefinedCarver c : config.getCarvers()) {
|
for(UserDefinedCarver c : config.getCarvers()) {
|
||||||
CarverTemplate template = c.getConfig();
|
CarverTemplate template = c.getConfig();
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class FloraPopulator implements TerraBlockPopulator {
|
|||||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||||
TerraWorld tw = main.getWorld(world);
|
TerraWorld tw = main.getWorld(world);
|
||||||
try(ProfileFuture ignored = tw.getProfiler().measure("FloraTime")) {
|
try(ProfileFuture ignored = tw.getProfiler().measure("FloraTime")) {
|
||||||
|
if(tw.getConfig().getTemplate().disableCarvers()) return;
|
||||||
|
|
||||||
if(!tw.isSafe()) return;
|
if(!tw.isSafe()) return;
|
||||||
BiomeProvider provider = tw.getBiomeProvider();
|
BiomeProvider provider = tw.getBiomeProvider();
|
||||||
Map<Vector2, List<FloraLayer>> layers = new HashMap<>();
|
Map<Vector2, List<FloraLayer>> layers = new HashMap<>();
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public class OrePopulator implements TerraBlockPopulator {
|
|||||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||||
TerraWorld tw = main.getWorld(world);
|
TerraWorld tw = main.getWorld(world);
|
||||||
try(ProfileFuture ignored = tw.getProfiler().measure("OreTime")) {
|
try(ProfileFuture ignored = tw.getProfiler().measure("OreTime")) {
|
||||||
|
if(tw.getConfig().getTemplate().disableCarvers()) return;
|
||||||
|
|
||||||
if(!tw.isSafe()) return;
|
if(!tw.isSafe()) return;
|
||||||
for(int cx = -1; cx <= 1; cx++) {
|
for(int cx = -1; cx <= 1; cx++) {
|
||||||
for(int cz = -1; cz <= 1; cz++) {
|
for(int cz = -1; cz <= 1; cz++) {
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class StructurePopulator implements TerraBlockPopulator, Chunkified {
|
|||||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||||
TerraWorld tw = main.getWorld(world);
|
TerraWorld tw = main.getWorld(world);
|
||||||
try(ProfileFuture ignored = tw.getProfiler().measure("StructureTime")) {
|
try(ProfileFuture ignored = tw.getProfiler().measure("StructureTime")) {
|
||||||
|
if(tw.getConfig().getTemplate().disableCarvers()) return;
|
||||||
|
|
||||||
int cx = (chunk.getX() << 4);
|
int cx = (chunk.getX() << 4);
|
||||||
int cz = (chunk.getZ() << 4);
|
int cz = (chunk.getZ() << 4);
|
||||||
if(!tw.isSafe()) return;
|
if(!tw.isSafe()) return;
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public class TreePopulator implements TerraBlockPopulator {
|
|||||||
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
public void populate(@NotNull World world, @NotNull Chunk chunk) {
|
||||||
TerraWorld tw = main.getWorld(world);
|
TerraWorld tw = main.getWorld(world);
|
||||||
try(ProfileFuture ignored = tw.getProfiler().measure("TreeTime")) {
|
try(ProfileFuture ignored = tw.getProfiler().measure("TreeTime")) {
|
||||||
|
if(tw.getConfig().getTemplate().disableCarvers()) return;
|
||||||
|
|
||||||
if(!tw.isSafe()) return;
|
if(!tw.isSafe()) return;
|
||||||
BiomeProvider provider = tw.getBiomeProvider();
|
BiomeProvider provider = tw.getBiomeProvider();
|
||||||
Random random = PopulationUtil.getRandom(chunk);
|
Random random = PopulationUtil.getRandom(chunk);
|
||||||
|
|||||||
Reference in New Issue
Block a user