diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2023-03-14 16:33:03 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-14 16:33:03 -0500 |
| commit | 12a9c8ce65b58f0c600fd7b9fc5d454ce228b420 (patch) | |
| tree | 9bada4164ea12fa533d413c0c7090f4779b519f1 /azalea-world/src/entity/data.rs | |
| parent | b792e21d1c2b7dba04d88dba479ed451104a6514 (diff) | |
| download | azalea-drasl-12a9c8ce65b58f0c600fd7b9fc5d454ce228b420.tar.xz | |
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
Diffstat (limited to 'azalea-world/src/entity/data.rs')
| -rwxr-xr-x | azalea-world/src/entity/data.rs | 34 |
1 files changed, 29 insertions, 5 deletions
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<BlockPos>), Direction(Direction), OptionalUuid(Option<Uuid>), - // 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<GlobalPos>), PaintingVariant(azalea_registry::PaintingVariant), + SnifferState(SnifferState), + Vector3(Vec3), + Quaternion(Quaternion), } #[derive(Clone, Debug)] pub struct OptionalUnsignedInt(pub Option<u32>); +#[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<Self, BufReadError> { let val = u32::var_read_from(buf)?; @@ -160,3 +172,15 @@ impl TryFrom<EntityMetadataItems> for Vec<EntityDataValue> { Ok(data) } } + +#[derive(Debug, Copy, Clone, McBuf, Default)] +pub enum SnifferState { + #[default] + Idling, + FeelingHappy, + Scenting, + Sniffing, + Searching, + Digging, + Rising, +} |
