use rand::{seq::SliceRandom, thread_rng}; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] pub enum Body { Arrow, Bomb, Scarecrow, Cauldron, ChestVines, Chest, ChestDark, ChestDemon, ChestGold, ChestLight, ChestOpen, ChestSkull, Pumpkin, Pumpkin2, Pumpkin3, Pumpkin4, Pumpkin5, Campfire, LanternGround, LanternGroundOpen, LanternStanding2, LanternStanding, PotionBlue, PotionGreen, PotionRed, Crate, Tent, WindowSpooky, DoorSpooky, Anvil, Gravestone, Gravestone2, Bench, Chair, Chair2, Chair3, Table, Table2, Table3, Drawer, BedBlue, Carpet, Bedroll, CarpetHumanRound, CarpetHumanSquare, CarpetHumanSquare2, CarpetHumanSquircle, Pouch, CraftingBench, } impl Body { pub fn random() -> Self { let mut rng = thread_rng(); *(&ALL_OBJECTS).choose(&mut rng).unwrap() } } const ALL_OBJECTS: [Body; 48] = [ Body::Arrow, Body::Bomb, Body::Scarecrow, Body::Cauldron, Body::ChestVines, Body::Chest, Body::ChestDark, Body::ChestDemon, Body::ChestGold, Body::ChestLight, Body::ChestOpen, Body::ChestSkull, Body::Pumpkin, Body::Pumpkin2, Body::Pumpkin3, Body::Pumpkin4, Body::Pumpkin5, Body::Campfire, Body::LanternGround, Body::LanternGroundOpen, Body::LanternStanding, Body::LanternStanding2, Body::PotionRed, Body::PotionBlue, Body::PotionGreen, Body::Crate, Body::Tent, Body::WindowSpooky, Body::DoorSpooky, Body::Anvil, Body::Gravestone, Body::Gravestone2, Body::Bench, Body::Chair, Body::Chair2, Body::Chair3, Body::Table, Body::Table2, Body::Table3, Body::Drawer, Body::BedBlue, Body::Carpet, Body::Bedroll, Body::CarpetHumanRound, Body::CarpetHumanSquare, Body::CarpetHumanSquare2, Body::CarpetHumanSquircle, Body::CraftingBench, ];