pub enum HeightProvider {
Constant(VerticalAnchor),
Uniform {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
},
Trapezoid {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
plateau: i32,
},
BiasedToBottom {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
inner: i32,
},
VeryBiasedToBottom {
min_inclusive: VerticalAnchor,
max_inclusive: VerticalAnchor,
inner: i32,
},
}Expand description
An int-valued provider parameterised by world-generation bounds
(min_y, height).
Mirrors vanilla’s HeightProvider hierarchy.
Variants§
Constant(VerticalAnchor)
Always resolves to a fixed anchor.
Uniform
Uniform inclusive over [min, max].
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
Trapezoid
Sum of two next_i32_bounded draws — symmetric triangle when
plateau == 0, trapezoid otherwise.
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
BiasedToBottom
Biased toward the bottom: two nested nextInt draws.
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
VeryBiasedToBottom
Heavily biased toward the bottom: three nested nextInt draws.
Fields
min_inclusive: VerticalAnchorInclusive lower bound.
max_inclusive: VerticalAnchorInclusive upper bound.
Implementations§
Source§impl HeightProvider
impl HeightProvider
Sourcepub fn sample<R: Random + ?Sized>(
self,
random: &mut R,
min_y: i32,
height: i32,
) -> i32
pub fn sample<R: Random + ?Sized>( self, random: &mut R, min_y: i32, height: i32, ) -> i32
Sample a Y coordinate.
Matches vanilla’s HeightProvider.sample — including the “empty range
returns min” fallback (vanilla logs a warning once; we silently fall
back to min since this branch isn’t hit in practice).
Trait Implementations§
Source§impl Clone for HeightProvider
impl Clone for HeightProvider
Source§fn clone(&self) -> HeightProvider
fn clone(&self) -> HeightProvider
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more