This commit is contained in:
dfsek
2021-01-29 10:37:35 -07:00
parent 7858cc34c2
commit 66fb481ac2
3 changed files with 6 additions and 22 deletions

View File

@@ -15,19 +15,12 @@ public class DomainWarpedSampler implements NoiseSampler {
@Override
public double getNoise(double x, double y) {
return function.getNoise(
x + warp.getNoiseSeeded(seed, x, y) * amplitude,
y + warp.getNoiseSeeded(seed + 1, x, y) * amplitude
);
return getNoiseSeeded(seed, x, y);
}
@Override
public double getNoise(double x, double y, double z) {
return function.getNoise(
x + warp.getNoiseSeeded(seed, x, y, z) * amplitude,
y + warp.getNoiseSeeded(seed + 1, x, y, z) * amplitude,
z + warp.getNoiseSeeded(seed + 2, x, y, z) * amplitude
);
return getNoiseSeeded(seed, x, y, z);
}
@Override
@@ -36,7 +29,6 @@ public class DomainWarpedSampler implements NoiseSampler {
x + warp.getNoiseSeeded(seed, x, y) * amplitude,
y + warp.getNoiseSeeded(seed + 1, x, y) * amplitude
);
}
@Override
@@ -46,6 +38,5 @@ public class DomainWarpedSampler implements NoiseSampler {
y + warp.getNoiseSeeded(seed + 1, x, y, z) * amplitude,
z + warp.getNoiseSeeded(seed + 2, x, y, z) * amplitude
);
}
}

View File

@@ -38,8 +38,7 @@ public class BiomeProviderBuilderLoader implements TypeLoader<BiomeProvider.Biom
@Override
public BiomeProvider.BiomeProviderBuilder load(Type t, Object c, ConfigLoader loader) throws LoadException { // TODO: clean this up
Map<String, Object> map = (Map<String, Object>) c;
int resolution = 1;
if(map.containsKey("resolution")) resolution = Integer.parseInt(map.get("resolution").toString());
int resolution = (Integer) map.getOrDefault("resolution", 1);
if(map.get("type").equals("PIPELINE")) {
Map<String, Object> pipeline = (Map<String, Object>) map.get("pipeline");
@@ -48,9 +47,7 @@ public class BiomeProviderBuilderLoader implements TypeLoader<BiomeProvider.Biom
if(stages == null) throw new LoadException("No pipeline stages defined!");
int init;
if(pipeline.containsKey("initial-size")) init = Integer.parseInt(pipeline.get("initial-size").toString());
else init = 3;
int init = (Integer) pipeline.getOrDefault("initial-size", 2);
StandardBiomeProvider.StandardBiomeProviderBuilder builder = new StandardBiomeProvider.StandardBiomeProviderBuilder(seed -> {
BiomePipeline.BiomePipelineBuilder pipelineBuilder = new BiomePipeline.BiomePipelineBuilder(init);

View File

@@ -129,12 +129,8 @@ public class NoiseSamplerBuilderLoader implements TypeLoader<NoiseSeeded> {
} else if(samplerType.equals("DOMAIN_WARP")) {
NoiseSeeded warp = (NoiseSeeded) loader.loadType(NoiseSeeded.class, map.get("warp"));
NoiseSeeded target = (NoiseSeeded) loader.loadType(NoiseSeeded.class, map.get("function"));
double amplitude = map.containsKey("amplitude")
? Double.parseDouble(map.get("amplitude").toString())
: 0;
int salt = map.containsKey("salt")
? Integer.parseInt(map.get("salt").toString())
: 0;
double amplitude = ((Number) map.getOrDefault("amplitude", 1)).doubleValue();
int salt = (Integer) map.getOrDefault("salt", 0);
return new NoiseSeeded() {
@Override
public NoiseSampler apply(Long seed) {