Skip to content

Commit fd8d89a

Browse files
committed
1 parent 13ef8de commit fd8d89a

131 files changed

Lines changed: 1080 additions & 1136 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pumpkin-macros/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn pumpkin_block(input: TokenStream, item: TokenStream) -> TokenStream {
181181

182182
let code = quote! {
183183
#item
184-
impl #impl_generics crate::block::pumpkin_block::BlockMetadata for #name #ty_generics {
184+
impl #impl_generics crate::block::BlockMetadata for #name #ty_generics {
185185
fn namespace(&self) -> &'static str {
186186
#namespace
187187
}
@@ -210,7 +210,7 @@ pub fn pumpkin_block_from_tag(input: TokenStream, item: TokenStream) -> TokenStr
210210

211211
let code = quote! {
212212
#item
213-
impl #impl_generics crate::block::pumpkin_block::BlockMetadata for #name #ty_generics {
213+
impl #impl_generics crate::block::BlockMetadata for #name #ty_generics {
214214
fn namespace(&self) -> &'static str {
215215
#namespace
216216
}

pumpkin/src/block/blocks/abstruct_wall_mounting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use pumpkin_data::{
66
use pumpkin_util::math::position::BlockPos;
77
use pumpkin_world::{BlockStateId, world::BlockAccessor};
88

9-
use crate::{block::pumpkin_block::GetStateForNeighborUpdateArgs, entity::player::Player};
9+
use crate::{block::GetStateForNeighborUpdateArgs, entity::player::Player};
1010

1111
#[async_trait]
1212
pub trait WallMountedBlock {

pumpkin/src/block/blocks/anvil.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::block::pumpkin_block::{OnPlaceArgs, PumpkinBlock};
1+
use crate::block::{BlockBehaviour, OnPlaceArgs};
22
use async_trait::async_trait;
33
use pumpkin_data::block_properties::{BlockProperties, WallTorchLikeProperties};
44
use pumpkin_data::tag::{RegistryKey, get_tag_values};
@@ -9,7 +9,7 @@ use pumpkin_world::BlockStateId;
99
pub struct AnvilBlock;
1010

1111
#[async_trait]
12-
impl PumpkinBlock for AnvilBlock {
12+
impl BlockBehaviour for AnvilBlock {
1313
async fn on_place(&self, args: OnPlaceArgs<'_>) -> BlockStateId {
1414
let dir = args
1515
.player

pumpkin/src/block/blocks/bamboo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use pumpkin_data::tag;
33
use pumpkin_data::tag::Taggable;
44
use pumpkin_macros::pumpkin_block;
55

6-
use crate::block::pumpkin_block::{CanPlaceAtArgs, PumpkinBlock};
6+
use crate::block::{BlockBehaviour, CanPlaceAtArgs};
77

88
#[pumpkin_block("minecraft:bamboo")]
99
pub struct BambooBlock;
1010

1111
#[async_trait]
12-
impl PumpkinBlock for BambooBlock {
12+
impl BlockBehaviour for BambooBlock {
1313
async fn can_place_at(&self, args: CanPlaceAtArgs<'_>) -> bool {
1414
let block_below = args.block_accessor.get_block(&args.position.down()).await;
1515
block_below.is_tagged_with_by_tag(&tag::Block::MINECRAFT_BAMBOO_PLANTABLE_ON)

pumpkin/src/block/blocks/banners.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::block::pumpkin_block::{OnPlaceArgs, PumpkinBlock};
1+
use crate::block::{BlockBehaviour, OnPlaceArgs};
22
use crate::entity::EntityBase;
33
use async_trait::async_trait;
44
use pumpkin_data::block_properties::{BlockProperties, WhiteBannerLikeProperties};
@@ -10,7 +10,7 @@ use pumpkin_world::BlockStateId;
1010
pub struct BannerBlock;
1111

1212
#[async_trait]
13-
impl PumpkinBlock for BannerBlock {
13+
impl BlockBehaviour for BannerBlock {
1414
async fn on_place(&self, args: OnPlaceArgs<'_>) -> BlockStateId {
1515
let mut props = WhiteBannerLikeProperties::default(args.block);
1616
props.rotation = args.player.get_entity().get_flipped_rotation_16();

pumpkin/src/block/blocks/barrel.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::sync::Arc;
22

3-
use crate::block::pumpkin_block::{OnPlaceArgs, PlacedArgs};
3+
use crate::block::{OnPlaceArgs, PlacedArgs};
44
use crate::block::{
5-
pumpkin_block::{NormalUseArgs, PumpkinBlock},
65
registry::BlockActionResult,
6+
{BlockBehaviour, NormalUseArgs},
77
};
88
use async_trait::async_trait;
99
use pumpkin_data::block_properties::{BarrelLikeProperties, BlockProperties};
@@ -43,7 +43,7 @@ impl ScreenHandlerFactory for BarrelScreenFactory {
4343
pub struct BarrelBlock;
4444

4545
#[async_trait]
46-
impl PumpkinBlock for BarrelBlock {
46+
impl BlockBehaviour for BarrelBlock {
4747
async fn normal_use(&self, args: NormalUseArgs<'_>) -> BlockActionResult {
4848
if let Some(block_entity) = args.world.get_block_entity(args.position).await {
4949
if let Some(inventory) = block_entity.get_inventory() {

pumpkin/src/block/blocks/bed.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ use pumpkin_world::BlockStateId;
1515
use pumpkin_world::block::entities::bed::BedBlockEntity;
1616
use pumpkin_world::world::BlockFlags;
1717

18-
use crate::block::pumpkin_block::{
19-
BrokenArgs, CanPlaceAtArgs, NormalUseArgs, OnPlaceArgs, PlacedArgs, PumpkinBlock,
20-
};
2118
use crate::block::registry::BlockActionResult;
19+
use crate::block::{
20+
BlockBehaviour, BrokenArgs, CanPlaceAtArgs, NormalUseArgs, OnPlaceArgs, PlacedArgs,
21+
};
2222
use crate::entity::{Entity, EntityBase};
2323
use crate::world::World;
2424

@@ -66,7 +66,7 @@ const NO_SLEEP_IDS: &[u16] = &[
6666
pub struct BedBlock;
6767

6868
#[async_trait]
69-
impl PumpkinBlock for BedBlock {
69+
impl BlockBehaviour for BedBlock {
7070
async fn can_place_at(&self, args: CanPlaceAtArgs<'_>) -> bool {
7171
if let Some(player) = args.player {
7272
let facing = player.living_entity.entity.get_horizontal_facing();

pumpkin/src/block/blocks/blast_furnace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::block::pumpkin_block::{OnPlaceArgs, PumpkinBlock};
1+
use crate::block::{BlockBehaviour, OnPlaceArgs};
22
use async_trait::async_trait;
33
use pumpkin_data::block_properties::{BlockProperties, FurnaceLikeProperties};
44
use pumpkin_macros::pumpkin_block;
@@ -8,7 +8,7 @@ use pumpkin_world::BlockStateId;
88
pub struct BlastFurnaceBlock;
99

1010
#[async_trait]
11-
impl PumpkinBlock for BlastFurnaceBlock {
11+
impl BlockBehaviour for BlastFurnaceBlock {
1212
async fn on_place(&self, args: OnPlaceArgs<'_>) -> BlockStateId {
1313
let mut props = FurnaceLikeProperties::default(args.block);
1414
props.facing = args

pumpkin/src/block/blocks/cactus.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ use pumpkin_world::BlockStateId;
1111
use pumpkin_world::tick::TickPriority;
1212
use pumpkin_world::world::{BlockAccessor, BlockFlags};
1313

14-
use crate::block::pumpkin_block::{
15-
CanPlaceAtArgs, GetStateForNeighborUpdateArgs, OnEntityCollisionArgs, OnScheduledTickArgs,
16-
PumpkinBlock, RandomTickArgs,
14+
use crate::block::{
15+
BlockBehaviour, CanPlaceAtArgs, GetStateForNeighborUpdateArgs, OnEntityCollisionArgs,
16+
OnScheduledTickArgs, RandomTickArgs,
1717
};
1818

1919
#[pumpkin_block("minecraft:cactus")]
2020
pub struct CactusBlock;
2121

2222
#[async_trait]
23-
impl PumpkinBlock for CactusBlock {
23+
impl BlockBehaviour for CactusBlock {
2424
async fn on_scheduled_tick(&self, args: OnScheduledTickArgs<'_>) {
2525
if !can_place_at(args.world.as_ref(), args.position).await {
2626
args.world

pumpkin/src/block/blocks/cake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use std::sync::Arc;
33
use crate::{
44
block::{
55
blocks::candle_cakes::cake_from_candle,
6-
pumpkin_block::{NormalUseArgs, PumpkinBlock, UseWithItemArgs},
76
registry::BlockActionResult,
7+
{BlockBehaviour, NormalUseArgs, UseWithItemArgs},
88
},
99
entity::player::Player,
1010
world::World,
@@ -79,7 +79,7 @@ impl CakeBlock {
7979
}
8080

8181
#[async_trait]
82-
impl PumpkinBlock for CakeBlock {
82+
impl BlockBehaviour for CakeBlock {
8383
async fn use_with_item(&self, args: UseWithItemArgs<'_>) -> BlockActionResult {
8484
let state_id = args.world.get_block_state_id(args.position).await;
8585
let properties = CakeLikeProperties::from_state_id(state_id, args.block);

0 commit comments

Comments
 (0)