mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-05-19 16:20:46 +00:00
Fix erosion NPE, add missing config
This commit is contained in:
Generated
+5
@@ -81,5 +81,10 @@
|
|||||||
<option name="name" value="MavenLocal" />
|
<option name="name" value="MavenLocal" />
|
||||||
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
|
||||||
</remote-repository>
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="maven3" />
|
||||||
|
<option name="name" value="maven3" />
|
||||||
|
<option name="url" value="https://repo.codemc.org/repository/maven-releases" />
|
||||||
|
</remote-repository>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
Vendored
BIN
Binary file not shown.
@@ -59,7 +59,7 @@ public class TerraBiomeGrid extends BiomeGrid {
|
|||||||
failNum++;
|
failNum++;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if(erode.isEroded(xp, zp)) return b.getErode();
|
if(erode != null && erode.isEroded(xp, zp)) return b.getErode();
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ public class GeneratorBuilder {
|
|||||||
|
|
||||||
private boolean preventInterpolation;
|
private boolean preventInterpolation;
|
||||||
|
|
||||||
|
private boolean interpolateElevation;
|
||||||
|
|
||||||
public WorldGenerator build(long seed) {
|
public WorldGenerator build(long seed) {
|
||||||
return gens.computeIfAbsent(seed, k -> new WorldGenerator(seed, noiseEquation, elevationEquation, varScope, noiseBuilderMap, palettes, slantPalettes, preventInterpolation));
|
return gens.computeIfAbsent(seed, k -> new WorldGenerator(seed, noiseEquation, elevationEquation, varScope, noiseBuilderMap, palettes, slantPalettes, preventInterpolation, interpolateElevation));
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNoiseEquation() {
|
public String getNoiseEquation() {
|
||||||
@@ -84,4 +86,12 @@ public class GeneratorBuilder {
|
|||||||
public void setPreventInterpolation(boolean preventInterpolation) {
|
public void setPreventInterpolation(boolean preventInterpolation) {
|
||||||
this.preventInterpolation = preventInterpolation;
|
this.preventInterpolation = preventInterpolation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInterpolateElevation(boolean interpolateElevation) {
|
||||||
|
this.interpolateElevation = interpolateElevation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean interpolateElevation() {
|
||||||
|
return interpolateElevation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ public class BiomeFactory implements TerraFactory<BiomeTemplate, UserDefinedBiom
|
|||||||
generatorBuilder.setPalettes(template.getPalette());
|
generatorBuilder.setPalettes(template.getPalette());
|
||||||
generatorBuilder.setSlantPalettes(template.getSlantPalette());
|
generatorBuilder.setSlantPalettes(template.getSlantPalette());
|
||||||
generatorBuilder.setVarScope(pack.getVarScope());
|
generatorBuilder.setVarScope(pack.getVarScope());
|
||||||
|
generatorBuilder.setInterpolateElevation(template.interpolateElevation());
|
||||||
|
|
||||||
|
|
||||||
return new UserDefinedBiome(template.getVanilla(), decorator, generatorBuilder, template, pack);
|
return new UserDefinedBiome(template.getVanilla(), decorator, generatorBuilder, template, pack);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.dfsek.tectonic.exception.ConfigException;
|
|||||||
import com.dfsek.tectonic.exception.LoadException;
|
import com.dfsek.tectonic.exception.LoadException;
|
||||||
import com.dfsek.tectonic.loading.ConfigLoader;
|
import com.dfsek.tectonic.loading.ConfigLoader;
|
||||||
import com.dfsek.tectonic.loading.TypeLoader;
|
import com.dfsek.tectonic.loading.TypeLoader;
|
||||||
import com.dfsek.terra.Debug;
|
|
||||||
import com.dfsek.terra.generation.config.NoiseBuilder;
|
import com.dfsek.terra.generation.config.NoiseBuilder;
|
||||||
import org.polydev.gaea.math.FastNoiseLite;
|
import org.polydev.gaea.math.FastNoiseLite;
|
||||||
|
|
||||||
@@ -29,14 +28,10 @@ public class NoiseBuilderLoader implements TypeLoader<NoiseBuilder> {
|
|||||||
public NoiseBuilder load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
|
public NoiseBuilder load(Type type, Object o, ConfigLoader configLoader) throws LoadException {
|
||||||
NoiseBuilder builder = new NoiseBuilder();
|
NoiseBuilder builder = new NoiseBuilder();
|
||||||
try {
|
try {
|
||||||
Debug.info(o + "");
|
|
||||||
LOADER.load(builder, new Configuration((Map<String, Object>) o));
|
LOADER.load(builder, new Configuration((Map<String, Object>) o));
|
||||||
} catch(ConfigException e) {
|
} catch(ConfigException e) {
|
||||||
throw new LoadException("Could not load noise", e);
|
throw new LoadException("Could not load noise", e);
|
||||||
}
|
}
|
||||||
Debug.info("FREQ: " + builder.getFrequency());
|
|
||||||
Debug.info("FRAC: " + builder.getFractalType());
|
|
||||||
Debug.info("OCT:" + builder.getOctaves());
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,15 @@ public class BiomeTemplate extends AbstractableTemplate implements ValidatedConf
|
|||||||
@Default
|
@Default
|
||||||
private double slantThreshold = 0.1;
|
private double slantThreshold = 0.1;
|
||||||
|
|
||||||
|
@Value("interpolate-elevation")
|
||||||
|
@Abstractable
|
||||||
|
@Default
|
||||||
|
private boolean interpolateElevation = true;
|
||||||
|
|
||||||
|
public boolean interpolateElevation() {
|
||||||
|
return interpolateElevation;
|
||||||
|
}
|
||||||
|
|
||||||
public double getSlantThreshold() {
|
public double getSlantThreshold() {
|
||||||
return slantThreshold;
|
return slantThreshold;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ public class WorldGenerator extends Generator {
|
|||||||
private final Variable zVar;
|
private final Variable zVar;
|
||||||
private final Variable elevationXVar;
|
private final Variable elevationXVar;
|
||||||
private final Variable elevationZVar;
|
private final Variable elevationZVar;
|
||||||
private boolean elevationInterpolation = true;
|
private final boolean elevationInterpolation;
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public WorldGenerator(long seed, String equation, String elevateEquation, Scope vScope, Map<String, NoiseBuilder> noiseBuilders, PaletteHolder palettes, PaletteHolder slantPalettes, boolean preventSmooth) {
|
public WorldGenerator(long seed, String equation, String elevateEquation, Scope vScope, Map<String, NoiseBuilder> noiseBuilders, PaletteHolder palettes, PaletteHolder slantPalettes, boolean preventSmooth, boolean elevationInterpolation) {
|
||||||
Parser p = new Parser();
|
Parser p = new Parser();
|
||||||
p.registerFunction("rand", new RandomFunction());
|
p.registerFunction("rand", new RandomFunction());
|
||||||
Parser ep = new Parser();
|
Parser ep = new Parser();
|
||||||
@@ -52,6 +52,8 @@ public class WorldGenerator extends Generator {
|
|||||||
this.palettes = palettes;
|
this.palettes = palettes;
|
||||||
this.slantPalettes = slantPalettes;
|
this.slantPalettes = slantPalettes;
|
||||||
|
|
||||||
|
this.elevationInterpolation = elevationInterpolation;
|
||||||
|
|
||||||
for(Map.Entry<String, NoiseBuilder> e : noiseBuilders.entrySet()) {
|
for(Map.Entry<String, NoiseBuilder> e : noiseBuilders.entrySet()) {
|
||||||
switch(e.getValue().getDimensions()) {
|
switch(e.getValue().getDimensions()) {
|
||||||
case 2:
|
case 2:
|
||||||
@@ -133,8 +135,4 @@ public class WorldGenerator extends Generator {
|
|||||||
return elevationInterpolation;
|
return elevationInterpolation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorldGenerator setElevationInterpolation(boolean elevationInterpolation) {
|
|
||||||
this.elevationInterpolation = elevationInterpolation;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user