mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Cleanup noise functions
This commit is contained in:
parent
022c95a862
commit
f5a503f546
@ -79,7 +79,6 @@ public class ConfigPack extends YamlConfiguration {
|
||||
private final File dataFolder;
|
||||
private final String id;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ConfigPack(File file) throws IOException, InvalidConfigurationException {
|
||||
long l = System.nanoTime();
|
||||
load(new File(file, "pack.yml"));
|
||||
@ -90,8 +89,9 @@ public class ConfigPack extends YamlConfiguration {
|
||||
|
||||
Map<String, Object> noise = Objects.requireNonNull(getConfigurationSection("noise")).getValues(false);
|
||||
for(Map.Entry<String, Object> entry : noise.entrySet()) {
|
||||
noiseBuilders.put(entry.getKey(), new NoiseConfig((ConfigurationSection) entry.getValue()));
|
||||
Debug.info("Loaded noise function " + entry.getKey());
|
||||
NoiseConfig noiseConfig = new NoiseConfig((ConfigurationSection) entry.getValue());
|
||||
noiseBuilders.put(entry.getKey(), noiseConfig);
|
||||
Debug.info("Loaded noise function " + entry.getKey() + " with type " + noiseConfig.getBuilder().getType());
|
||||
}
|
||||
|
||||
ores = ConfigLoader.load(new File(file, "ores").toPath(), this, OreConfig.class);
|
||||
|
@ -9,11 +9,10 @@ public class NoiseConfig {
|
||||
private final NoiseBuilder builder;
|
||||
private final int dimensions;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public NoiseConfig(ConfigurationSection section) throws ConfigException {
|
||||
NoiseBuilder builder = new NoiseBuilder();
|
||||
try {
|
||||
builder.setType(FastNoiseLite.NoiseType.valueOf((String) section.get("type")));
|
||||
builder.setType(FastNoiseLite.NoiseType.valueOf(section.getString("type", "OpenSimplex2")));
|
||||
builder.setFrequency(section.getDouble("frequency", 0.02D));
|
||||
|
||||
dimensions = section.getInt("dimensions", 3);
|
||||
|
@ -37,6 +37,8 @@ public class NoiseBuilder {
|
||||
noise.setCellularJitter(cellularJitter);
|
||||
}
|
||||
|
||||
noise.setNoiseType(type);
|
||||
|
||||
noise.setDomainWarpType(domainWarpType);
|
||||
noise.setDomainWarpAmp(domainWarpAmp);
|
||||
|
||||
@ -105,5 +107,57 @@ public class NoiseBuilder {
|
||||
public void setRotationType3D(FastNoiseLite.RotationType3D rotationType3D) {
|
||||
this.rotationType3D = rotationType3D;
|
||||
}
|
||||
|
||||
public FastNoiseLite.CellularDistanceFunction getCellularDistanceFunction() {
|
||||
return cellularDistanceFunction;
|
||||
}
|
||||
|
||||
public FastNoiseLite.CellularReturnType getCellularReturnType() {
|
||||
return cellularReturnType;
|
||||
}
|
||||
|
||||
public FastNoiseLite.DomainWarpType getDomainWarpType() {
|
||||
return domainWarpType;
|
||||
}
|
||||
|
||||
public double getCellularJitter() {
|
||||
return cellularJitter;
|
||||
}
|
||||
|
||||
public double getDomainWarpAmp() {
|
||||
return domainWarpAmp;
|
||||
}
|
||||
|
||||
public double getFractalGain() {
|
||||
return fractalGain;
|
||||
}
|
||||
|
||||
public double getFractalLacunarity() {
|
||||
return fractalLacunarity;
|
||||
}
|
||||
|
||||
public double getFrequency() {
|
||||
return frequency;
|
||||
}
|
||||
|
||||
public double getPingPong() {
|
||||
return pingPong;
|
||||
}
|
||||
|
||||
public double getWeightedStrength() {
|
||||
return weightedStrength;
|
||||
}
|
||||
|
||||
public int getOctaves() {
|
||||
return octaves;
|
||||
}
|
||||
|
||||
public FastNoiseLite.FractalType getFractalType() {
|
||||
return fractalType;
|
||||
}
|
||||
|
||||
public FastNoiseLite.RotationType3D getRotationType3D() {
|
||||
return rotationType3D;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user