Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions steel-core/src/behavior/blocks/building/glazed_terracotta_block.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! Glazed terracotta block behavior.

use steel_macros::block_behavior;
use steel_registry::blocks::BlockRef;
use steel_registry::blocks::block_state_ext::BlockStateExt;
use steel_registry::blocks::properties::BlockStateProperties;
use steel_utils::BlockStateId;

use crate::behavior::block::BlockBehavior;
use crate::behavior::context::BlockPlaceContext;

/// Vanilla `GlazedTerracottaBlock` placement facing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is needed because its pub

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh ok forgot that, to long no coding

#[block_behavior]
pub struct GlazedTerracottaBlock {
block: BlockRef,
}

impl GlazedTerracottaBlock {
/// Creates a new glazed terracotta block behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is needed because its pub

#[must_use]
pub const fn new(block: BlockRef) -> Self {
Self { block }
}
}

impl BlockBehavior for GlazedTerracottaBlock {
fn get_state_for_placement(&self, context: &BlockPlaceContext<'_>) -> Option<BlockStateId> {
Some(self.block.default_state().set_value(
&BlockStateProperties::HORIZONTAL_FACING,
context.horizontal_direction().opposite(),
))
}
}
2 changes: 2 additions & 0 deletions steel-core/src/behavior/blocks/building/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod campfire_block;
mod door_block;
mod fence_block;
mod fence_gate_block;
mod glazed_terracotta_block;
mod hay_block;
mod honey_block;
mod ladder_block;
Expand Down Expand Up @@ -38,6 +39,7 @@ pub use campfire_block::CampfireBlock;
pub use door_block::{DoorBlock, WeatheringCopperDoorBlock};
pub use fence_block::FenceBlock;
pub use fence_gate_block::FenceGateBlock;
pub use glazed_terracotta_block::GlazedTerracottaBlock;
pub use hay_block::HayBlock;
pub use honey_block::HoneyBlock;
pub use ladder_block::LadderBlock;
Expand Down
7 changes: 4 additions & 3 deletions steel-core/src/behavior/blocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ pub mod vegetation;

pub use building::{
AmethystBlock, AmethystClusterBlock, BarrierBlock, BedBlock, BuddingAmethystBlock,
CampfireBlock, DoorBlock, FenceBlock, FenceGateBlock, HayBlock, HoneyBlock, IronBarsBlock,
LadderBlock, LavaCauldronBlock, MagmaBlock, PotentSulfurBlock, PowderSnowBlock,
RotatedPillarBlock, ScaffoldingBlock, SlabBlock, SlimeBlock, SpongeBlock, StairBlock,
CampfireBlock, DoorBlock, FenceBlock, FenceGateBlock, GlazedTerracottaBlock, HayBlock,
HoneyBlock, IronBarsBlock, LadderBlock, LavaCauldronBlock, MagmaBlock, PotentSulfurBlock,
PowderSnowBlock, RotatedPillarBlock, ScaffoldingBlock, SlabBlock, SlimeBlock, SpongeBlock,
StairBlock,
TrapDoorBlock, WallBlock, WaterloggedTransparentBlock, WeatherState, WeatheringCopper,
WeatheringCopperBarsBlock, WeatheringCopperDoorBlock, WeatheringCopperFullBlock,
WeatheringCopperGrateBlock, WeatheringCopperSlabBlock, WeatheringCopperStairBlock,
Expand Down
Loading