mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
fix shield blocking
(shields still don't reduce/block damage, but you can block with it)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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::<ConsumableImpl>() {
|
||||
return value.consume_ticks();
|
||||
}
|
||||
// TODO: this causes a panic
|
||||
// if self.get_data_component::<BlocksAttacksImpl>().is_some() {
|
||||
// return 72000;
|
||||
// }
|
||||
if self.get_data_component::<BlocksAttacksImpl>().is_some() {
|
||||
return 72000;
|
||||
}
|
||||
0
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user