mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +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.ConfigException;
|
||||||
import com.dfsek.terra.config.exception.NotFoundException;
|
import com.dfsek.terra.config.exception.NotFoundException;
|
||||||
import com.dfsek.terra.config.genconfig.CarverConfig;
|
import com.dfsek.terra.config.genconfig.CarverConfig;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
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.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
public class BiomeCarverConfig extends TerraConfigSection {
|
public class BiomeCarverConfig extends TerraConfigSection {
|
||||||
private final Map<CarverConfig, Integer> carvers = new HashMap<>();
|
private final Map<CarverConfig, Integer> carvers = new HashMap<>();
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public BiomeCarverConfig(TerraConfig parent) throws InvalidConfigurationException {
|
public BiomeCarverConfig(TerraConfig parent) throws InvalidConfigurationException {
|
||||||
super(parent);
|
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;
|
if(cfg.size() == 0) return;
|
||||||
for(Map<?, ?> e : cfg) {
|
for(Map.Entry<String, Object> entry : cfg.entrySet()) {
|
||||||
for(Map.Entry<?, ?> entry : e.entrySet()) {
|
try {
|
||||||
try {
|
CarverConfig c = parent.getConfig().getCarver(entry.getKey());
|
||||||
CarverConfig c = parent.getConfig().getCarver((String) entry.getKey());
|
if(c == null) throw new NotFoundException("Carver", entry.getKey(), parent.getID());
|
||||||
if(c == null) throw new NotFoundException("Carver", (String) entry.getKey(), parent.getID());
|
Debug.info("Got carver " + c + ". Adding with weight " + entry.getValue());
|
||||||
Debug.info("Got carver " + c + ". Adding with weight " + entry.getValue());
|
carvers.put(c, (Integer) entry.getValue());
|
||||||
carvers.put(c, (Integer) entry.getValue());
|
} catch(ClassCastException ex) {
|
||||||
} catch(ClassCastException ex) {
|
throw new ConfigException("Unable to parse Carver configuration! Check YAML syntax.", parent.getID());
|
||||||
throw new ConfigException("Unable to parse Carver configuration! Check YAML syntax.", parent.getID());
|
} catch(NullPointerException ex) {
|
||||||
} catch(NullPointerException ex) {
|
throw new NotFoundException("carver", entry.getKey(), parent.getID());
|
||||||
throw new NotFoundException("carver", (String) entry.getKey(), parent.getID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,8 +59,9 @@ blend:
|
|||||||
erode:
|
erode:
|
||||||
enable: true
|
enable: true
|
||||||
frequency: 0.005
|
frequency: 0.005
|
||||||
threshold: 0.1
|
threshold: 0.001
|
||||||
|
octaves: 4
|
||||||
grid: "BIOME:RIVER"
|
grid: "BIOME:RIVER"
|
||||||
noise:
|
noise:
|
||||||
octaves: 5
|
octaves: 4
|
||||||
frequency: 0.0075
|
frequency: 0.01
|
Loading…
x
Reference in New Issue
Block a user