steel_core/behavior/blocks/vegetation/
glow_lichen_block.rs1use steel_macros::block_behavior;
2use steel_registry::blocks::properties::Direction;
3use steel_utils::{BlockPos, BlockStateId};
4
5use crate::behavior::block::BlockBehavior;
6use crate::behavior::context::BlockPlaceContext;
7use crate::world::{LevelReader, ScheduledTickAccess};
8
9use super::{BlockRef, default_surviving_state, multiface_can_survive, update_multiface_shape};
10
11#[block_behavior]
17pub struct GlowLichenBlock {
18 block: BlockRef,
19}
20
21impl GlowLichenBlock {
22 #[must_use]
24 pub const fn new(block: BlockRef) -> Self {
25 Self { block }
26 }
27}
28
29impl BlockBehavior for GlowLichenBlock {
30 fn update_shape(
31 &self,
32 state: BlockStateId,
33 world: &dyn ScheduledTickAccess,
34 pos: BlockPos,
35 direction: Direction,
36 neighbor_pos: BlockPos,
37 neighbor_state: BlockStateId,
38 ) -> BlockStateId {
39 update_multiface_shape(state, world, pos, direction, neighbor_pos, neighbor_state)
40 }
41
42 fn can_survive(&self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos) -> bool {
43 multiface_can_survive(state, world, pos)
44 }
45
46 fn get_state_for_placement(&self, context: &BlockPlaceContext<'_>) -> Option<BlockStateId> {
47 default_surviving_state(self.block, self, context)
50 }
51}