1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

Add best effort for default max stack sizes

This commit is contained in:
EnderKill98 2025-08-02 02:26:34 +02:00
parent e7bf124ed5
commit d1e67703eb

View file

@ -19,7 +19,57 @@ pub trait MaxStackSizeExt {
impl MaxStackSizeExt for azalea_registry::Item { impl MaxStackSizeExt for azalea_registry::Item {
fn max_stack_size(&self) -> i32 { fn max_stack_size(&self) -> i32 {
// TODO: have the properties for every item defined somewhere // Best effort, might have forgotten some niche item
64 let name = self.to_string();
if [
Self::ShulkerBox,
Self::Potion,
Self::SplashPotion,
Self::LingeringPotion,
Self::AxolotlBucket,
Self::Minecart,
Self::Trident,
Self::Mace,
Self::Bow,
Self::Crossbow,
Self::TotemOfUndying,
Self::Shield,
Self::Cake,
Self::Shears,
Self::Bundle,
Self::EnchantedBook,
Self::DebugStick,
Self::WritableBook,
]
.contains(self)
|| name.ends_with("_shulker_box")
|| name.ends_with("_bucket")
|| name.ends_with("_pattern")
|| name.ends_with("_minecart")
|| name.ends_with("_boat")
|| name.ends_with("_helmet")
|| name.ends_with("_leggings")
|| name.ends_with("_chestplate")
|| name.ends_with("_boots")
|| name.ends_with("_sword")
|| name.ends_with("_axe")
|| name.ends_with("_pickaxe")
|| name.ends_with("_shovel")
|| name.ends_with("_hoe")
|| name.ends_with("_horse_armor")
|| name.ends_with("_soup")
|| name.ends_with("_bundle")
|| name.contains("music_disc_")
|| name.contains("_bed")
{
1
} else if [Self::Bucket, Self::EnderPearl, Self::Snowball, Self::Egg, Self::ArmorStand, Self::WrittenBook].contains(self)
|| name.ends_with("_sign")
|| name.ends_with("_banner")
{
16
} else {
64
}
} }
} }