steel_core/behavior/blocks/vegetation/
sculk_vein_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::blocks::MultifaceBlock;
7use crate::behavior::context::BlockPlaceContext;
8use crate::world::{LevelReader, ScheduledTickAccess};
9
10use super::BlockRef;
11
12#[block_behavior]
18pub struct SculkVeinBlock {
19 multiface: MultifaceBlock,
20}
21
22impl SculkVeinBlock {
23 #[must_use]
25 pub const fn new(block: BlockRef) -> Self {
26 Self {
27 multiface: MultifaceBlock::new(block),
28 }
29 }
30}
31
32impl BlockBehavior for SculkVeinBlock {
33 fn update_shape(
34 &self,
35 state: BlockStateId,
36 world: &dyn ScheduledTickAccess,
37 pos: BlockPos,
38 direction: Direction,
39 neighbor_pos: BlockPos,
40 neighbor_state: BlockStateId,
41 ) -> BlockStateId {
42 self.multiface
43 .update_shape(state, world, pos, direction, neighbor_pos, neighbor_state)
44 }
45
46 fn can_survive(&self, state: BlockStateId, world: &dyn LevelReader, pos: BlockPos) -> bool {
47 self.multiface.can_survive(state, world, pos)
48 }
49
50 fn get_state_for_placement(&self, context: &BlockPlaceContext<'_>) -> Option<BlockStateId> {
51 self.multiface.get_state_for_placement(context)
52 }
53
54 fn can_be_replaced(&self, state: BlockStateId, context: &BlockPlaceContext<'_>) -> bool {
55 self.multiface.can_be_replaced(state, context)
56 }
57}