Skip to main content

steel_core/behavior/blocks/
utils.rs

1use steel_registry::blocks::BlockRef;
2use steel_registry::blocks::properties::{BlockStateProperties, BoolProperty};
3use steel_registry::vanilla_block_tags::BlockTag;
4use steel_registry::vanilla_blocks::{
5    BARRIER, CARVED_PUMPKIN, JACK_O_LANTERN, MANGROVE_LEAVES, MELON, PUMPKIN,
6};
7use steel_utils::Direction;
8
9pub fn is_excluded_for_connection(block: BlockRef) -> bool {
10    block.has_tag(&BlockTag::LEAVES)
11        || block == &BARRIER
12        || block == &CARVED_PUMPKIN
13        || block == &JACK_O_LANTERN
14        || block == &MELON
15        || block == &PUMPKIN
16        || block.has_tag(&BlockTag::SHULKER_BOXES)
17        || block == &MANGROVE_LEAVES
18}
19
20/// Vanilla `MultifaceBlock.getFaceProperty(faceDirection)`.
21pub(crate) const fn multiface_face_property(direction: Direction) -> &'static BoolProperty {
22    match direction {
23        Direction::Up => &BlockStateProperties::UP,
24        Direction::Down => &BlockStateProperties::DOWN,
25        Direction::North => &BlockStateProperties::NORTH,
26        Direction::South => &BlockStateProperties::SOUTH,
27        Direction::East => &BlockStateProperties::EAST,
28        Direction::West => &BlockStateProperties::WEST,
29    }
30}