From 12a9c8ce65b58f0c600fd7b9fc5d454ce228b420 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Tue, 14 Mar 2023 16:33:03 -0500 Subject: 1.19.4 (#57) * 23w03a * 23w04a * 23w05a * 23w06a * fix * 23w07a mojang broke their json data generator so some stuff is missing * didn't mean to commit that file here * 1.19.4-pre2 * fix * 1.19.4-pre3 * fix * how did these packets get here * 1.19.4-pre4 * 1.19.4-rc1 * 1.19.4-rc2 * 1.19.4-rc3 * merge main * remove debugging code * 1.19.4 --- azalea-world/src/entity/data.rs | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'azalea-world/src/entity/data.rs') diff --git a/azalea-world/src/entity/data.rs b/azalea-world/src/entity/data.rs index 65988a19..664efe1c 100755 --- a/azalea-world/src/entity/data.rs +++ b/azalea-world/src/entity/data.rs @@ -1,11 +1,10 @@ //! Define some types needed for entity metadata. -use azalea_block::BlockState; use azalea_buf::{ BufReadError, McBuf, McBufReadable, McBufVarReadable, McBufVarWritable, McBufWritable, }; use azalea_chat::FormattedText; -use azalea_core::{BlockPos, Direction, GlobalPos, Particle, Slot}; +use azalea_core::{BlockPos, Direction, GlobalPos, Particle, Slot, Vec3}; use bevy_ecs::component::Component; use derive_more::Deref; use enum_as_inner::EnumAsInner; @@ -50,6 +49,8 @@ impl McBufWritable for EntityMetadataItems { } } +// Note: This enum is partially generated and parsed by +// codegen/lib/code/entity.py #[derive(Clone, Debug, EnumAsInner, McBuf)] pub enum EntityDataValue { Byte(u8), @@ -66,9 +67,9 @@ pub enum EntityDataValue { OptionalBlockPos(Option), Direction(Direction), OptionalUuid(Option), - // 0 for absent (implies air); otherwise, a block state ID as per the global palette - // this is a varint - BlockState(BlockState), + BlockState(azalea_block::BlockState), + /// If this is air, that means it's absent, + OptionalBlockState(azalea_block::BlockState), CompoundTag(azalea_nbt::Tag), Particle(Particle), VillagerData(VillagerData), @@ -79,11 +80,22 @@ pub enum EntityDataValue { FrogVariant(azalea_registry::FrogVariant), OptionalGlobalPos(Option), PaintingVariant(azalea_registry::PaintingVariant), + SnifferState(SnifferState), + Vector3(Vec3), + Quaternion(Quaternion), } #[derive(Clone, Debug)] pub struct OptionalUnsignedInt(pub Option); +#[derive(Clone, Debug, McBuf)] +pub struct Quaternion { + pub x: f32, + pub y: f32, + pub z: f32, + pub w: f32, +} + impl McBufReadable for OptionalUnsignedInt { fn read_from(buf: &mut Cursor<&[u8]>) -> Result { let val = u32::var_read_from(buf)?; @@ -160,3 +172,15 @@ impl TryFrom for Vec { Ok(data) } } + +#[derive(Debug, Copy, Clone, McBuf, Default)] +pub enum SnifferState { + #[default] + Idling, + FeelingHappy, + Scenting, + Sniffing, + Searching, + Digging, + Rising, +} -- cgit v1.2.3