use yog_data::Schema;
use yog_data::with::RefTo;
use yog_registry::ArmorSlot;
use super::refs::{MaterialRef, ToolKindRef};
use crate::def::{ArmorMaterialKind, ToolMaterialKind};
#[derive(Schema, Debug, Clone)]
pub struct Food {
#[data(range = "0..=1000")]
pub nutrition: u32,
#[data(default, range = "0..=100")]
pub saturation: f64,
#[data(default)]
pub always_edible: bool,
}
#[derive(Schema, Debug, Clone)]
pub struct PotionProps {
pub name: Option<String>,
pub effects: Vec<yog_registry::PotionEffect>,
}
#[derive(Schema, Debug, Clone, Default)]
pub struct ItemProps {
#[data(range = "1..=99")]
pub stack_size: Option<u8>,
#[data(range = "0..=1000000000")]
pub durability: Option<u32>,
#[data(default)]
pub fire_resistant: bool,
#[data(range = "0..=1000000000")]
pub fuel_ticks: Option<u32>,
pub food: Option<Food>,
pub tool: Option<ToolProps>,
pub armor: Option<ArmorProps>,
pub wearable: Option<ArmorSlot>,
pub potion: Option<PotionProps>,
pub hangs: Option<HangsProps>,
}
#[derive(Schema, Debug, Clone)]
pub struct HangsProps {
#[data(with = "RefTo<yog_data::kinds::Entity>")]
pub entity: String,
pub size: Option<[u32; 2]>,
}
#[derive(Schema, Debug, Clone, Default)]
pub struct BlockItemProps {
#[data(range = "1..=99")]
pub stack_size: Option<u8>,
#[data(default)]
pub fire_resistant: bool,
#[data(range = "0..=1000000000")]
pub fuel_ticks: Option<u32>,
}
#[derive(Schema, Debug, Clone)]
pub struct ToolProps {
#[data(with = "ToolKindRef")]
pub kind: String,
#[data(with = "MaterialRef<ToolMaterialKind>")]
pub material: String,
pub attack_damage: Option<f32>,
pub attack_speed: Option<f32>,
}
#[derive(Schema, Debug, Clone)]
pub struct ArmorProps {
pub slot: ArmorSlot,
#[data(with = "MaterialRef<ArmorMaterialKind>")]
pub material: String,
}