From bc2bdb87b2f8a588d018215a0c598145ad06fd66 Mon Sep 17 00:00:00 2001 From: Alexander Medvedev Date: Wed, 20 Aug 2025 16:11:48 +0200 Subject: [PATCH] fix shield blocking (shields still don't reduce/block damage, but you can block with it) --- pumpkin-data/build/item.rs | 2 +- pumpkin-world/src/item/mod.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pumpkin-data/build/item.rs b/pumpkin-data/build/item.rs index ba68b3bbd..34175f265 100644 --- a/pumpkin-data/build/item.rs +++ b/pumpkin-data/build/item.rs @@ -234,7 +234,7 @@ impl ToTokens for ItemComponents { }; if self.blocks_attacks.is_some() { - tokens.extend(quote! { (Consumable, &BlocksAttacksImpl), }); + tokens.extend(quote! { (BlocksAttacks, &BlocksAttacksImpl), }); }; if let Some(equippable) = &self.equippable { diff --git a/pumpkin-world/src/item/mod.rs b/pumpkin-world/src/item/mod.rs index fdcd21d44..958cef62a 100644 --- a/pumpkin-world/src/item/mod.rs +++ b/pumpkin-world/src/item/mod.rs @@ -1,7 +1,8 @@ use pumpkin_data::Block; use pumpkin_data::data_component::DataComponent; use pumpkin_data::data_component_impl::{ - ConsumableImpl, DataComponentImpl, IDSet, MaxStackSizeImpl, ToolImpl, get, read_data, + BlocksAttacksImpl, ConsumableImpl, DataComponentImpl, IDSet, MaxStackSizeImpl, ToolImpl, get, + read_data, }; use pumpkin_data::item::Item; use pumpkin_data::recipes::RecipeResultStruct; @@ -91,10 +92,9 @@ impl ItemStack { if let Some(value) = self.get_data_component::() { return value.consume_ticks(); } - // TODO: this causes a panic - // if self.get_data_component::().is_some() { - // return 72000; - // } + if self.get_data_component::().is_some() { + return 72000; + } 0 }