diff --git a/pumpkin/src/block/blocks/mod.rs b/pumpkin/src/block/blocks/mod.rs index d57e2a9b8..83c6adb4c 100644 --- a/pumpkin/src/block/blocks/mod.rs +++ b/pumpkin/src/block/blocks/mod.rs @@ -60,7 +60,6 @@ pub mod torches; pub mod trapdoor; pub mod vine; pub mod walls; -pub mod wither_rose; pub mod wither_skull; pub mod banners; diff --git a/pumpkin/src/block/blocks/plant/mod.rs b/pumpkin/src/block/blocks/plant/mod.rs index 9fd8f0686..9d51142ff 100644 --- a/pumpkin/src/block/blocks/plant/mod.rs +++ b/pumpkin/src/block/blocks/plant/mod.rs @@ -21,6 +21,7 @@ pub mod segmented; pub mod short_plant; pub mod sugar_cane; pub mod tall_plant; +pub mod wither_rose; trait PlantBlockBase { async fn can_plant_on_top(&self, block_accessor: &dyn BlockAccessor, pos: &BlockPos) -> bool { diff --git a/pumpkin/src/block/blocks/wither_rose.rs b/pumpkin/src/block/blocks/plant/wither_rose.rs similarity index 62% rename from pumpkin/src/block/blocks/wither_rose.rs rename to pumpkin/src/block/blocks/plant/wither_rose.rs index 8553ddfc3..61f567ad9 100644 --- a/pumpkin/src/block/blocks/wither_rose.rs +++ b/pumpkin/src/block/blocks/plant/wither_rose.rs @@ -1,8 +1,10 @@ +use crate::block::{GetStateForNeighborUpdateArgs, blocks::plant::PlantBlockBase}; use pumpkin_data::{effect::StatusEffect, entity::EntityType}; use pumpkin_macros::pumpkin_block; use pumpkin_util::Difficulty; +use pumpkin_world::BlockStateId; -use crate::block::{BlockBehaviour, BlockFuture, OnEntityCollisionArgs}; +use crate::block::{BlockBehaviour, BlockFuture, CanPlaceAtArgs, OnEntityCollisionArgs}; #[pumpkin_block("minecraft:wither_rose")] pub struct WitherRose; @@ -36,4 +38,25 @@ impl BlockBehaviour for WitherRose { } }) } + fn can_place_at<'a>(&'a self, args: CanPlaceAtArgs<'a>) -> BlockFuture<'a, bool> { + Box::pin(async move { + ::can_place_at(self, args.block_accessor, args.position).await + }) + } + fn get_state_for_neighbor_update<'a>( + &'a self, + args: GetStateForNeighborUpdateArgs<'a>, + ) -> BlockFuture<'a, BlockStateId> { + Box::pin(async move { + ::get_state_for_neighbor_update( + self, + args.world, + args.position, + args.state_id, + ) + .await + }) + } } + +impl PlantBlockBase for WitherRose {} diff --git a/pumpkin/src/block/registry.rs b/pumpkin/src/block/registry.rs index 5eaf86382..80eb38bef 100644 --- a/pumpkin/src/block/registry.rs +++ b/pumpkin/src/block/registry.rs @@ -64,6 +64,7 @@ use crate::block::blocks::plant::sea_pickles::SeaPickleBlock; use crate::block::blocks::plant::short_plant::ShortPlantBlock; use crate::block::blocks::plant::sugar_cane::SugarCaneBlock; use crate::block::blocks::plant::tall_plant::TallPlantBlock; +use crate::block::blocks::plant::wither_rose::WitherRose; use crate::block::blocks::powder_snow::PowderSnowBlock; use crate::block::blocks::pumpkin::PumpkinBlock; use crate::block::blocks::redstone::buttons::ButtonBlock; @@ -100,7 +101,6 @@ use crate::block::blocks::torches::TorchBlock; use crate::block::blocks::trapdoor::TrapDoorBlock; use crate::block::blocks::vine::VineBlock; use crate::block::blocks::walls::WallBlock; -use crate::block::blocks::wither_rose::WitherRose; use crate::block::blocks::wither_skull::WitherSkeletonSkullBlock; use crate::block::fluid::lava::FlowingLava; use crate::block::fluid::water::FlowingWater;