mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Let ConfigPacks include Vanilla caves, structures, and mobs.
This commit is contained in:
parent
edfafb64d8
commit
e82e8cb17d
@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.config.base;
|
||||
|
||||
import com.dfsek.terra.Terra;
|
||||
import com.dfsek.terra.biome.UserDefinedBiome;
|
||||
import com.dfsek.terra.carving.UserDefinedCarver;
|
||||
import com.dfsek.terra.config.ConfigLoader;
|
||||
@ -16,8 +17,6 @@ import com.dfsek.terra.config.genconfig.biome.AbstractBiomeConfig;
|
||||
import com.dfsek.terra.config.genconfig.biome.BiomeConfig;
|
||||
import com.dfsek.terra.config.lang.LangUtil;
|
||||
import com.dfsek.terra.util.StructureTypeEnum;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -35,7 +34,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
* Represents a Terra configuration pack.
|
||||
@ -77,6 +75,11 @@ public class ConfigPack extends YamlConfiguration {
|
||||
public final int octaves;
|
||||
public final double frequency;
|
||||
|
||||
public final boolean vanillaCaves;
|
||||
public final boolean vanillaStructures;
|
||||
public final boolean vanillaDecoration;
|
||||
public final boolean vanillaMobs;
|
||||
|
||||
public final Map<StructureTypeEnum, StructureConfig> locatable = new HashMap<>();
|
||||
|
||||
public ConfigPack(File file) throws IOException, InvalidConfigurationException {
|
||||
@ -123,6 +126,15 @@ public class ConfigPack extends YamlConfiguration {
|
||||
|
||||
erosionName = getString("erode.grid");
|
||||
|
||||
vanillaCaves = getBoolean("vanilla.caves", false);
|
||||
vanillaStructures = getBoolean("vanilla.structures", false);
|
||||
vanillaDecoration = getBoolean("vanilla.decorations", false);
|
||||
vanillaMobs = getBoolean("vanilla.mobs", false);
|
||||
|
||||
if(vanillaMobs || vanillaDecoration || vanillaStructures || vanillaCaves) {
|
||||
Terra.getInstance().getLogger().warning("WARNING: Vanilla features have been enabled! These features may not work properly, and are not officially supported! Use at your own risk!");
|
||||
}
|
||||
|
||||
// Load BiomeGrids from BiomeZone
|
||||
biomeList = getStringList("grids");
|
||||
|
||||
|
@ -47,16 +47,14 @@ import java.util.logging.Level;
|
||||
public class TerraChunkGenerator extends GaeaChunkGenerator {
|
||||
private final PopulationManager popMan = new PopulationManager(Terra.getInstance());
|
||||
private boolean needsLoad = true;
|
||||
private final int octaves;
|
||||
private final double frequency;
|
||||
private final ConfigPack configPack;
|
||||
|
||||
|
||||
private static final Map<World, PopulationManager> popMap = new HashMap<>();
|
||||
|
||||
public TerraChunkGenerator(ConfigPack c) {
|
||||
super(ChunkInterpolator.InterpolationType.TRILINEAR);
|
||||
this.frequency = c.frequency;
|
||||
this.octaves = c.octaves;
|
||||
this.configPack = c;
|
||||
popMan.attach(new FloraPopulator());
|
||||
popMan.attach(new OrePopulator());
|
||||
popMan.attach(new SnowPopulator());
|
||||
@ -163,12 +161,12 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
||||
|
||||
@Override
|
||||
public int getNoiseOctaves(World world) {
|
||||
return octaves;
|
||||
return configPack.octaves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getNoiseFrequency(World world) {
|
||||
return frequency;
|
||||
return configPack.frequency;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -187,9 +185,24 @@ public class TerraChunkGenerator extends GaeaChunkGenerator {
|
||||
return Arrays.asList(new CavePopulator(), new StructurePopulator(), popMan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateCaves() {
|
||||
return configPack.vanillaCaves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateDecorations() {
|
||||
return configPack.vanillaDecoration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateMobs() {
|
||||
return configPack.vanillaMobs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldGenerateStructures() {
|
||||
return false;
|
||||
return configPack.vanillaStructures;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user