mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-02 16:05:29 +00:00
Improve cave config readability
This commit is contained in:
parent
a5b75f4275
commit
1ccd14a973
@ -6,38 +6,33 @@ import com.dfsek.terra.config.TerraConfigSection;
|
||||
import com.dfsek.terra.config.exception.ConfigException;
|
||||
import com.dfsek.terra.config.exception.NotFoundException;
|
||||
import com.dfsek.terra.config.genconfig.CarverConfig;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.polydev.gaea.math.ProbabilityCollection;
|
||||
import org.polydev.gaea.world.palette.Palette;
|
||||
import org.polydev.gaea.world.palette.RandomPalette;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class BiomeCarverConfig extends TerraConfigSection {
|
||||
private final Map<CarverConfig, Integer> carvers = new HashMap<>();
|
||||
@SuppressWarnings("unchecked")
|
||||
public BiomeCarverConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||
super(parent);
|
||||
List<Map<?, ?>> cfg = parent.getMapList("carving");
|
||||
ConfigurationSection configurationSection = parent.getConfigurationSection("carving");
|
||||
|
||||
Map<String, Object> cfg;
|
||||
if(configurationSection != null) {
|
||||
cfg = configurationSection.getValues(false);
|
||||
} else return;
|
||||
if(cfg.size() == 0) return;
|
||||
for(Map<?, ?> e : cfg) {
|
||||
for(Map.Entry<?, ?> entry : e.entrySet()) {
|
||||
try {
|
||||
CarverConfig c = parent.getConfig().getCarver((String) entry.getKey());
|
||||
if(c == null) throw new NotFoundException("Carver", (String) entry.getKey(), parent.getID());
|
||||
Debug.info("Got carver " + c + ". Adding with weight " + entry.getValue());
|
||||
carvers.put(c, (Integer) entry.getValue());
|
||||
} catch(ClassCastException ex) {
|
||||
throw new ConfigException("Unable to parse Carver configuration! Check YAML syntax.", parent.getID());
|
||||
} catch(NullPointerException ex) {
|
||||
throw new NotFoundException("carver", (String) entry.getKey(), parent.getID());
|
||||
}
|
||||
for(Map.Entry<String, Object> entry : cfg.entrySet()) {
|
||||
try {
|
||||
CarverConfig c = parent.getConfig().getCarver(entry.getKey());
|
||||
if(c == null) throw new NotFoundException("Carver", entry.getKey(), parent.getID());
|
||||
Debug.info("Got carver " + c + ". Adding with weight " + entry.getValue());
|
||||
carvers.put(c, (Integer) entry.getValue());
|
||||
} catch(ClassCastException ex) {
|
||||
throw new ConfigException("Unable to parse Carver configuration! Check YAML syntax.", parent.getID());
|
||||
} catch(NullPointerException ex) {
|
||||
throw new NotFoundException("carver", entry.getKey(), parent.getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,9 @@ blend:
|
||||
erode:
|
||||
enable: true
|
||||
frequency: 0.005
|
||||
threshold: 0.1
|
||||
threshold: 0.001
|
||||
octaves: 4
|
||||
grid: "BIOME:RIVER"
|
||||
noise:
|
||||
octaves: 5
|
||||
frequency: 0.0075
|
||||
octaves: 4
|
||||
frequency: 0.01
|
Loading…
x
Reference in New Issue
Block a user