steel_core/behavior/blocks/vegetation/
growing_plant_block.rs1use steel_registry::blocks::{BlockRef, block_state_ext::BlockStateExt};
2use steel_utils::{BlockPos, Direction};
3
4use crate::world::LevelReader;
5
6pub(crate) fn can_survive(
9 world: &dyn LevelReader,
10 pos: BlockPos,
11 growth_direction: Direction,
12 head: BlockRef,
13 body: BlockRef,
14) -> bool {
15 let attached_pos = pos.relative(growth_direction.opposite());
16 let attached_state = world.get_block_state(attached_pos);
17 let attached_block = attached_state.get_block();
18 attached_block == head
19 || attached_block == body
20 || world.is_face_sturdy(attached_state, attached_pos, growth_direction)
21}