fix: ci/test

This commit is contained in:
Alexander Medvedev
2026-06-11 23:02:42 +02:00
parent 5b8eab0f56
commit acb295b250
2 changed files with 5 additions and 27 deletions

View File

@@ -297,6 +297,7 @@ impl WorldAquiferSampler {
let z = block_z + section_coords::section_to_block(offset_z as i32);
let n = height_estimator.estimate_height(x, z);
println!("estimate_height({}, {}) = {}", x, z, n);
let o = n + 8;
let bl2 = offset_x == 0 && offset_z == 0;
@@ -1504,7 +1505,7 @@ mod random_positions_and_hypot {
&mut height_estimator,
&env,
);
assert_eq!(level.max_y, y1);
assert_eq!(level.max_y, y1, "Failed at x={}, y={}, z={}", x, y, z);
assert_eq!(level.block, &state);
}
}

View File

@@ -93,9 +93,6 @@ impl<'a> SurfaceHeightEstimateSampler<'a> {
&sample_options,
);
let mut low = self.minimum_y;
let mut high = upper.ceil() as i32;
// First find the coarse cell that contains the surface
let cell_height = fts.cell_height();
let mut y = (upper / cell_height as f64).floor() as i32 * cell_height;
@@ -106,32 +103,12 @@ impl<'a> SurfaceHeightEstimateSampler<'a> {
&sample_options,
);
if density > 0.0 {
low = y;
high = (y + cell_height).min(high);
break;
return y;
}
y -= cell_height;
}
if y < self.minimum_y {
return self.minimum_y;
}
// Binary search for precise surface
while high - low > 1 {
let mid = low + (high - low) / 2;
let density = ChunkNoiseFunctionComponent::sample_from_stack(
&mut self.component_stack[..=fts.density_index()],
&Vector3::new(aligned_x, mid, aligned_z),
&sample_options,
);
if density > 0.0 {
low = mid;
} else {
high = mid;
}
}
return low + 1;
return self.minimum_y;
}
let surface_y = ChunkNoiseFunctionComponent::sample_from_stack(
@@ -139,7 +116,7 @@ impl<'a> SurfaceHeightEstimateSampler<'a> {
&pos,
&sample_options,
);
surface_y.floor() as i32 + 1
surface_y.floor() as i32
}
#[must_use]