minecraft_command_types/command/
dialog.rs

1use crate::entity_selector::EntitySelector;
2use crate::resource_location::ResourceLocation;
3use minecraft_command_types_derive::HasMacro;
4use std::fmt::{Display, Formatter};
5
6#[derive(Debug, Clone, Eq, PartialEq, Hash, HasMacro)]
7pub enum DialogCommand {
8    Show(EntitySelector, ResourceLocation),
9    Clear(EntitySelector),
10}
11
12impl Display for DialogCommand {
13    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
14        match self {
15            DialogCommand::Show(selector, dialog) => {
16                write!(f, "show {} {}", selector, dialog)
17            }
18            DialogCommand::Clear(selector) => {
19                write!(f, "clear {}", selector)
20            }
21        }
22    }
23}