mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-31 08:22:33 +00:00
feat: finalize wither-rose implementation (#1692)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
<Self as PlantBlockBase>::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 {
|
||||
<Self as PlantBlockBase>::get_state_for_neighbor_update(
|
||||
self,
|
||||
args.world,
|
||||
args.position,
|
||||
args.state_id,
|
||||
)
|
||||
.await
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl PlantBlockBase for WitherRose {}
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user