Only calculate slope if slant is defined

This commit is contained in:
Astrashh
2021-04-29 16:42:00 +10:00
parent 5542dee7b7
commit df2c654192
@@ -10,9 +10,11 @@ public final class PaletteUtil {
public static Palette getPalette(int x, int y, int z, BiomeTemplate c, Sampler sampler) { public static Palette getPalette(int x, int y, int z, BiomeTemplate c, Sampler sampler) {
SlantHolder slant = c.getSlant(); SlantHolder slant = c.getSlant();
double slope = MathUtil.derivative(sampler, x, y, z); if (slant != null) {
if (slant != null && slope > slant.getMinSlope()) { double slope = MathUtil.derivative(sampler, x, y, z);
return slant.getPalette(slope).getPalette(y); if (slope > slant.getMinSlope()) {
return slant.getPalette(slope).getPalette(y);
}
} }
return c.getPalette().getPalette(y); return c.getPalette().getPalette(y);