properly clamp max Y in LazilyEvaluatedInterpolator

This commit is contained in:
dfsek
2022-06-18 01:10:18 -07:00
parent 1d8c012ae5
commit 4c6c284b93
@@ -23,7 +23,7 @@ public class LazilyEvaluatedInterpolator {
private final PropertyKey<BiomeNoiseProperties> noisePropertiesKey; private final PropertyKey<BiomeNoiseProperties> noisePropertiesKey;
private final long seed; private final long seed;
private final int min; private final int min, max;
private final int zMul, yMul; private final int zMul, yMul;
public LazilyEvaluatedInterpolator(BiomeProvider biomeProvider, int cx, int cz, int max, public LazilyEvaluatedInterpolator(BiomeProvider biomeProvider, int cx, int cz, int max,
@@ -42,6 +42,7 @@ public class LazilyEvaluatedInterpolator {
this.biomeProvider = biomeProvider; this.biomeProvider = biomeProvider;
this.seed = seed; this.seed = seed;
this.min = min; this.min = min;
this.max = max;
} }
private double sample(int xIndex, int yIndex, int zIndex, int ox, int oy, int oz) { private double sample(int xIndex, int yIndex, int zIndex, int ox, int oy, int oz) {
@@ -51,12 +52,14 @@ public class LazilyEvaluatedInterpolator {
int xi = ox + chunkX; int xi = ox + chunkX;
int zi = oz + chunkZ; int zi = oz + chunkZ;
int y = FastMath.min(max, oy);
sample = biomeProvider sample = biomeProvider
.getBiome(xi, oy, zi, seed) .getBiome(xi, y, zi, seed)
.getContext() .getContext()
.get(noisePropertiesKey) .get(noisePropertiesKey)
.carving() .carving()
.noise(seed, xi, oy, zi); .noise(seed, xi, y, zi);
samples[index] = sample; samples[index] = sample;
} }
return sample; return sample;