Allows configuration of Generator interpolation smoothing

This commit is contained in:
dfsek
2020-10-18 14:26:41 -07:00
parent c3d5b55dcc
commit 55a74636a0
8 changed files with 13 additions and 5 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2 -2
View File
@@ -111,9 +111,9 @@
<dependency> <dependency>
<groupId>org.polydev</groupId> <groupId>org.polydev</groupId>
<artifactId>gaea</artifactId> <artifactId>gaea</artifactId>
<version>1.12.0</version> <version>1.12.1</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${basedir}/lib/Gaea-1.12.0.jar</systemPath> <systemPath>${basedir}/lib/Gaea-1.12.1.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
@@ -17,6 +17,6 @@ public final class FailoverGenerator extends UserDefinedGenerator {
palette.put(255, new RandomPalette<BlockData>(new Random(2403)).add(Material.STONE.createBlockData(), 1)); palette.put(255, new RandomPalette<BlockData>(new Random(2403)).add(Material.STONE.createBlockData(), 1));
} }
public FailoverGenerator() throws ParseException { 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 { try {
// Get UserDefinedBiome instance representing this config. // 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) { } catch(ParseException e) {
e.printStackTrace(); e.printStackTrace();
throw new ConfigException("Unable to parse noise equation!", getID()); 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 NoiseFunction2 n2 = new NoiseFunction2();
private final NoiseFunction3 n3 = new NoiseFunction3(); private final NoiseFunction3 n3 = new NoiseFunction3();
private final boolean preventSmooth;
private static final Object noiseLock = new Object(); 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(); Parser p = new Parser();
p.registerFunction("noise2", n2); p.registerFunction("noise2", n2);
p.registerFunction("noise3", n3); p.registerFunction("noise3", n3);
@@ -47,6 +49,7 @@ public class UserDefinedGenerator extends Generator {
palettes[y] = d; palettes[y] = d;
} }
this.noiseExp = p.parse(equation, s); this.noiseExp = p.parse(equation, s);
this.preventSmooth = preventSmooth;
} }
/** /**
* Gets the 2D noise at a pair of coordinates using the provided FastNoiseLite instance. * 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) { public Palette<BlockData> getPalette(int y) {
return palettes[y]; return palettes[y];
} }
@Override
public boolean useMinimalInterpolation() {
return preventSmooth;
}
} }