mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
Allows configuration of Generator interpolation smoothing
This commit is contained in:
@@ -17,6 +17,6 @@ public final class FailoverGenerator extends UserDefinedGenerator {
|
||||
palette.put(255, new RandomPalette<BlockData>(new Random(2403)).add(Material.STONE.createBlockData(), 1));
|
||||
}
|
||||
public FailoverGenerator() throws ParseException {
|
||||
super("0", Collections.emptyList(), palette);
|
||||
super("0", Collections.emptyList(), palette, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class BiomeConfig extends TerraConfig {
|
||||
|
||||
try {
|
||||
// Get UserDefinedBiome instance representing this config.
|
||||
this.biome = new UserDefinedBiome(vanillaBiome, dec, new UserDefinedGenerator(eq, Collections.emptyList(), palette.getPaletteMap()), getBoolean("erodible", false), biomeID);
|
||||
this.biome = new UserDefinedBiome(vanillaBiome, dec, new UserDefinedGenerator(eq, Collections.emptyList(), palette.getPaletteMap(), getBoolean("prevent-smooth", false)), getBoolean("erodible", false), biomeID);
|
||||
} catch(ParseException e) {
|
||||
e.printStackTrace();
|
||||
throw new ConfigException("Unable to parse noise equation!", getID());
|
||||
|
||||
@@ -29,10 +29,12 @@ public class UserDefinedGenerator extends Generator {
|
||||
private final NoiseFunction2 n2 = new NoiseFunction2();
|
||||
private final NoiseFunction3 n3 = new NoiseFunction3();
|
||||
|
||||
private final boolean preventSmooth;
|
||||
|
||||
private static final Object noiseLock = new Object();
|
||||
|
||||
|
||||
public UserDefinedGenerator(String equation, List<Variable> v, TreeMap<Integer, Palette<BlockData>> pa) throws ParseException {
|
||||
public UserDefinedGenerator(String equation, List<Variable> v, TreeMap<Integer, Palette<BlockData>> pa, boolean preventSmooth) throws ParseException {
|
||||
Parser p = new Parser();
|
||||
p.registerFunction("noise2", n2);
|
||||
p.registerFunction("noise3", n3);
|
||||
@@ -47,6 +49,7 @@ public class UserDefinedGenerator extends Generator {
|
||||
palettes[y] = d;
|
||||
}
|
||||
this.noiseExp = p.parse(equation, s);
|
||||
this.preventSmooth = preventSmooth;
|
||||
}
|
||||
/**
|
||||
* Gets the 2D noise at a pair of coordinates using the provided FastNoiseLite instance.
|
||||
@@ -98,4 +101,9 @@ public class UserDefinedGenerator extends Generator {
|
||||
public Palette<BlockData> getPalette(int y) {
|
||||
return palettes[y];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useMinimalInterpolation() {
|
||||
return preventSmooth;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user