Skip to main content

steel_core/behavior/items/
throwable_potion.rs

1use std::borrow::Cow;
2
3use steel_macros::item_behavior;
4use steel_registry::item_stack::ItemStack;
5use text_components::TextComponent;
6
7use crate::behavior::ItemBehavior;
8
9use super::dynamic_name::potion_name;
10
11/// Splash-potion behavior providing Vanilla's potion-content-dependent name.
12// TODO: Implement inherited PotionItem.useOn water-to-mud conversion.
13// TODO: Implement ThrowablePotionItem use and dispenser behavior once
14// thrown-potion entities and ProjectileItem dispatch exist.
15// TODO: Add the inherited water default instance when Steel has item-specific
16// default-stack factories.
17#[item_behavior]
18pub struct SplashPotionItem;
19
20impl ItemBehavior for SplashPotionItem {
21    fn get_name<'a>(&self, stack: &'a ItemStack) -> Cow<'a, TextComponent> {
22        potion_name(stack)
23    }
24}
25
26/// Lingering-potion behavior providing Vanilla's potion-content-dependent name.
27// TODO: Implement inherited PotionItem.useOn water-to-mud conversion.
28// TODO: Implement ThrowablePotionItem use and dispenser behavior once
29// thrown-potion entities and ProjectileItem dispatch exist.
30// TODO: Add the inherited water default instance when Steel has item-specific
31// default-stack factories.
32#[item_behavior]
33pub struct LingeringPotionItem;
34
35impl ItemBehavior for LingeringPotionItem {
36    fn get_name<'a>(&self, stack: &'a ItemStack) -> Cow<'a, TextComponent> {
37        potion_name(stack)
38    }
39}