pub struct SurfaceRuleContext<'a> {Show 16 fields
pub block_x: i32,
pub block_z: i32,
pub surface_depth: i32,
pub surface_secondary: f64,
pub min_surface_level: i32,
pub steep: bool,
pub block_y: i32,
pub stone_depth_above: i32,
pub stone_depth_below: i32,
pub water_height: i32,
biome_id: Option<u16>,
biome_provider: Option<&'a mut dyn SurfaceBiomeProvider>,
pub system: &'a dyn SurfaceNoiseProvider,
condition_noises: &'a SurfaceConditionNoiseCache<'a>,
block_states: &'a [BlockStateId],
cold_enough_to_snow: Option<bool>,
}Expand description
Context data passed to transpiled surface rule functions.
This is a flat struct holding all the values a surface rule condition might need.
The SurfaceContext in steel-core populates this and passes it to the generated
try_apply_surface_rule() function.
Fields§
§block_x: i32World X coordinate.
block_z: i32World Z coordinate.
surface_depth: i32Noise-based surface layer thickness (typically 3-6 blocks).
surface_secondary: f64Surface secondary noise value for depth variation.
min_surface_level: i32Minimum surface level from preliminary surface interpolation.
steep: boolWhether this column has a steep slope.
block_y: i32World Y coordinate.
stone_depth_above: i32How many solid blocks above the current position.
stone_depth_below: i32How many solid blocks below until the next cavity.
water_height: i32Y of water surface above this block, or i32::MIN if no water.
biome_id: Option<u16>Cached numeric biome ID at the current position, if already known.
biome_provider: Option<&'a mut dyn SurfaceBiomeProvider>Lazy biome lookup for rules that need the biome at this Y position.
system: &'a dyn SurfaceNoiseProviderReference to the surface system for noise lookups and band generation.
condition_noises: &'a SurfaceConditionNoiseCache<'a>Lazily populated column cache for surface condition noise values.
block_states: &'a [BlockStateId]Pre-resolved block states returned by generated surface rules.
cold_enough_to_snow: Option<bool>Lazily computed temperature condition value.
Implementations§
Source§impl<'a> SurfaceRuleContext<'a>
impl<'a> SurfaceRuleContext<'a>
Sourcepub fn new(
block_x: i32,
block_z: i32,
surface_depth: i32,
surface_secondary: f64,
min_surface_level: i32,
steep: bool,
block_y: i32,
stone_depth_above: i32,
stone_depth_below: i32,
water_height: i32,
biome_id: Option<u16>,
biome_provider: Option<&'a mut dyn SurfaceBiomeProvider>,
system: &'a dyn SurfaceNoiseProvider,
condition_noises: &'a SurfaceConditionNoiseCache<'a>,
block_states: &'a [BlockStateId],
) -> Self
pub fn new( block_x: i32, block_z: i32, surface_depth: i32, surface_secondary: f64, min_surface_level: i32, steep: bool, block_y: i32, stone_depth_above: i32, stone_depth_below: i32, water_height: i32, biome_id: Option<u16>, biome_provider: Option<&'a mut dyn SurfaceBiomeProvider>, system: &'a dyn SurfaceNoiseProvider, condition_noises: &'a SurfaceConditionNoiseCache<'a>, block_states: &'a [BlockStateId], ) -> Self
Creates a surface rule context for one block position.
Sourcepub fn condition_noise(&self, noise_index: usize) -> f64
pub fn condition_noise(&self, noise_index: usize) -> f64
Returns a column-cached surface condition noise value.
Sourcepub fn condition_noise_3d(&self, noise_index: usize) -> f64
pub fn condition_noise_3d(&self, noise_index: usize) -> f64
Returns an uncached surface condition noise value sampled at this block.
Sourcepub const fn block_state(&self, block_state_index: usize) -> BlockStateId
pub const fn block_state(&self, block_state_index: usize) -> BlockStateId
Returns a pre-resolved block state emitted by the generated surface rule.
Sourcepub const fn known_biome_id(&self) -> Option<u16>
pub const fn known_biome_id(&self) -> Option<u16>
Returns a biome ID already supplied by the caller.
Sourcepub fn biome_id(&mut self) -> Option<u16>
pub fn biome_id(&mut self) -> Option<u16>
Returns the current biome ID if this context was built with one.
Sourcepub fn cold_enough_to_snow(&mut self) -> bool
pub fn cold_enough_to_snow(&mut self) -> bool
Lazily evaluates the vanilla temperature surface condition.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for SurfaceRuleContext<'a>
impl<'a> !Send for SurfaceRuleContext<'a>
impl<'a> !Sync for SurfaceRuleContext<'a>
impl<'a> !UnwindSafe for SurfaceRuleContext<'a>
impl<'a> Freeze for SurfaceRuleContext<'a>
impl<'a> Unpin for SurfaceRuleContext<'a>
impl<'a> UnsafeUnpin for SurfaceRuleContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreArc<SyncMutex<>>