aboutsummaryrefslogtreecommitdiff
path: root/azalea-inventory/src/item
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-08-04 20:43:10 -0500
committerGitHub <noreply@github.com>2025-08-04 20:43:10 -0500
commit23b7f20a0d88b54d430820baeb4a6da0316a009a (patch)
treef3e780515b3bbb9973d2b94338be6194b5ec0af3 /azalea-inventory/src/item
parent827d943c3f27c65724ff83689b40c87d1cd1838c (diff)
downloadazalea-drasl-23b7f20a0d88b54d430820baeb4a6da0316a009a.tar.xz
Default components (#232)
* add default components * remove debug prints * clippy * use default components * fix tests
Diffstat (limited to 'azalea-inventory/src/item')
-rw-r--r--azalea-inventory/src/item/consume_effect.rs4
-rw-r--r--azalea-inventory/src/item/mod.rs5
2 files changed, 6 insertions, 3 deletions
diff --git a/azalea-inventory/src/item/consume_effect.rs b/azalea-inventory/src/item/consume_effect.rs
index 898f64ff..b9540955 100644
--- a/azalea-inventory/src/item/consume_effect.rs
+++ b/azalea-inventory/src/item/consume_effect.rs
@@ -10,7 +10,9 @@ pub enum ConsumeEffect {
effects: Vec<MobEffectInstance>,
probability: f32,
},
- RemoveEffects(HolderSet<MobEffect, ResourceLocation>),
+ RemoveEffects {
+ effects: HolderSet<MobEffect, ResourceLocation>,
+ },
ClearAllEffects,
TeleportRandomly {
diameter: f32,
diff --git a/azalea-inventory/src/item/mod.rs b/azalea-inventory/src/item/mod.rs
index bbff2d50..0e9947e2 100644
--- a/azalea-inventory/src/item/mod.rs
+++ b/azalea-inventory/src/item/mod.rs
@@ -1,3 +1,5 @@
+use crate::{components::MaxStackSize, default_components::get_default_component};
+
pub mod consume_effect;
pub trait MaxStackSizeExt {
@@ -19,7 +21,6 @@ pub trait MaxStackSizeExt {
impl MaxStackSizeExt for azalea_registry::Item {
fn max_stack_size(&self) -> i32 {
- // TODO: have the properties for every item defined somewhere
- 64
+ get_default_component::<MaxStackSize>(*self).map_or(64, |s| s.count)
}
}