Pumpkin/pumpkin/src/item/items/swords.rs
Alexander Medvedev ae751f3a83 remove #[async_trait] from many many places
Compile time got improved by 77% (including last commit)
2025-12-04 13:57:03 +01:00

23 lines
507 B
Rust

use crate::entity::player::Player;
use crate::item::{ItemBehaviour, ItemMetadata};
use pumpkin_data::tag;
use pumpkin_util::GameMode;
pub struct SwordItem;
impl ItemMetadata for SwordItem {
fn ids() -> Box<[u16]> {
tag::Item::MINECRAFT_SWORDS.1.to_vec().into_boxed_slice()
}
}
impl ItemBehaviour for SwordItem {
fn can_mine(&self, player: &Player) -> bool {
player.gamemode.load() != GameMode::Creative
}
fn as_any(&self) -> &dyn std::any::Any {
self
}
}