steel_core/worldgen/feature/features/
single_block_pillar.rs1use super::super::prelude::*;
2use super::super::runner::FeatureDecorationRunner;
3
4impl FeatureDecorationRunner {
5 pub(in crate::worldgen::feature) fn place_single_block_pillar_feature(
6 region: &mut WorldGenRegion<'_>,
7 registry: &Registry,
8 random: &mut WorldgenRandom,
9 config: &SingleBlockPillarConfiguration,
10 origin: BlockPos,
11 biome_zoom_seed: i64,
12 ) -> bool {
13 let mut pos = origin;
14 while BlockStateProviderEvaluator::test_block_predicate(
15 region,
16 registry,
17 &config.can_replace,
18 pos,
19 ) && random.next_f32() < config.chance_to_continue
20 && !region.is_outside_build_height(pos.y())
21 {
22 let state = BlockStateProviderEvaluator::sample_block_state_provider(
23 region,
24 registry,
25 random,
26 &config.block,
27 pos,
28 );
29 let _ = region.set_block_state(pos, state, UpdateFlags::UPDATE_CLIENTS);
30 pos = pos.relative(config.direction);
31 }
32
33 pos = pos.relative(config.direction.opposite());
34 if let Some(cap_feature) = &config.cap_feature {
35 Self::place_placed_feature_ref(
36 region,
37 registry,
38 random,
39 pos,
40 cap_feature,
41 biome_zoom_seed,
42 );
43 }
44
45 true
46 }
47}