aboutsummaryrefslogtreecommitdiff
path: root/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-11-12 23:54:05 -0600
committerGitHub <noreply@github.com>2022-11-12 23:54:05 -0600
commit6eee543a3367d38a6f0e9bffb457a2bd76a8f9cc (patch)
treea5e493ccd7ec24293b8d866242c3836146517122 /azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
parentfa57d03627aa20b1df44caed7cb025b6db1d9b53 (diff)
downloadazalea-drasl-6eee543a3367d38a6f0e9bffb457a2bd76a8f9cc.tar.xz
Pathfinder (#25)
Pathfinding is very much not done, but it works enough and I want to get this merged. TODO: fast replanning, goals that aren't a single node, falling moves (it should be able to play the dropper), parkour moves
Diffstat (limited to 'azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs')
-rwxr-xr-x[-rw-r--r--]azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs40
1 files changed, 3 insertions, 37 deletions
diff --git a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
index bcccdc3f..4c24ba64 100644..100755
--- a/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
+++ b/azalea-protocol/src/packets/game/clientbound_update_attributes_packet.rs
@@ -1,9 +1,7 @@
-use azalea_buf::{BufReadError, McBuf};
-use azalea_buf::{McBufReadable, McBufWritable};
+use azalea_buf::McBuf;
use azalea_core::ResourceLocation;
use azalea_protocol_macros::ClientboundGamePacket;
-use std::io::{Cursor, Write};
-use uuid::Uuid;
+use azalea_world::entity::attributes::AttributeModifier;
#[derive(Clone, Debug, McBuf, ClientboundGamePacket)]
pub struct ClientboundUpdateAttributesPacket {
@@ -16,37 +14,5 @@ pub struct ClientboundUpdateAttributesPacket {
pub struct AttributeSnapshot {
pub attribute: ResourceLocation,
pub base: f64,
- pub modifiers: Vec<Modifier>,
-}
-
-#[derive(Clone, Debug, McBuf)]
-pub struct Modifier {
- pub uuid: Uuid,
- pub amount: f64,
- pub operation: u8,
-}
-
-#[derive(Clone, Debug, Copy)]
-enum Operation {
- Addition = 0,
- MultiplyBase = 1,
- MultiplyTotal = 2,
-}
-
-impl McBufReadable for Operation {
- fn read_from(buf: &mut Cursor<&[u8]>) -> Result<Self, BufReadError> {
- match u8::read_from(buf)? {
- 0 => Ok(Operation::Addition),
- 1 => Ok(Operation::MultiplyBase),
- 2 => Ok(Operation::MultiplyTotal),
- id => Err(BufReadError::UnexpectedEnumVariant { id: id.into() }),
- }
- }
-}
-
-impl McBufWritable for Operation {
- fn write_into(&self, buf: &mut impl Write) -> Result<(), std::io::Error> {
- (*self as u8).write_into(buf)?;
- Ok(())
- }
+ pub modifiers: Vec<AttributeModifier>,
}