fix shield blocking

(shields still don't reduce/block damage, but you can block with it)
This commit is contained in:
Alexander Medvedev 2025-08-20 16:11:48 +02:00
parent 684db059e5
commit bc2bdb87b2
2 changed files with 6 additions and 6 deletions

View File

@ -234,7 +234,7 @@ impl ToTokens for ItemComponents {
}; };
if self.blocks_attacks.is_some() { if self.blocks_attacks.is_some() {
tokens.extend(quote! { (Consumable, &BlocksAttacksImpl), }); tokens.extend(quote! { (BlocksAttacks, &BlocksAttacksImpl), });
}; };
if let Some(equippable) = &self.equippable { if let Some(equippable) = &self.equippable {

View File

@ -1,7 +1,8 @@
use pumpkin_data::Block; use pumpkin_data::Block;
use pumpkin_data::data_component::DataComponent; use pumpkin_data::data_component::DataComponent;
use pumpkin_data::data_component_impl::{ 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::item::Item;
use pumpkin_data::recipes::RecipeResultStruct; use pumpkin_data::recipes::RecipeResultStruct;
@ -91,10 +92,9 @@ impl ItemStack {
if let Some(value) = self.get_data_component::<ConsumableImpl>() { if let Some(value) = self.get_data_component::<ConsumableImpl>() {
return value.consume_ticks(); return value.consume_ticks();
} }
// TODO: this causes a panic if self.get_data_component::<BlocksAttacksImpl>().is_some() {
// if self.get_data_component::<BlocksAttacksImpl>().is_some() { return 72000;
// return 72000; }
// }
0 0
} }