From 7857a014b92e64361ee237ceae7ef1acc185ac46 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:59:05 -0600 Subject: 1.20.3 (#110) * 23w40a * 23w41a * 23w42a * 23w43a * 23w44a * serialize FormattedText as nbt in network * use azalea-nbt/serde in azalea-chat * 23w45a * fix 23w45a to compile * handle Object in codegen * 1.20.3-pre2 * remove unused clientbound_resource_pack_packet.rs * merge main and make azalea-chat use simdnbt * 1.20.3-rc1 * fix tests * use simdnbt 0.3 * fix ServerboundSetJigsawBlockPacket * 1.20.3 --- azalea-core/src/objectives.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 azalea-core/src/objectives.rs (limited to 'azalea-core/src/objectives.rs') diff --git a/azalea-core/src/objectives.rs b/azalea-core/src/objectives.rs new file mode 100644 index 00000000..dd1534f2 --- /dev/null +++ b/azalea-core/src/objectives.rs @@ -0,0 +1,33 @@ +use std::{ + fmt::{self, Display, Formatter}, + str::FromStr, +}; + +use azalea_buf::McBuf; + +#[derive(Clone, Copy, Debug, McBuf)] +pub enum ObjectiveCriteria { + Integer, + Hearts, +} + +impl Display for ObjectiveCriteria { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + match self { + ObjectiveCriteria::Integer => write!(f, "integer"), + ObjectiveCriteria::Hearts => write!(f, "hearts"), + } + } +} + +impl FromStr for ObjectiveCriteria { + type Err = (); + + fn from_str(s: &str) -> Result { + match s { + "integer" => Ok(ObjectiveCriteria::Integer), + "hearts" => Ok(ObjectiveCriteria::Hearts), + _ => Err(()), + } + } +} -- cgit v1.2.3