entitiy -> entity

This commit is contained in:
StripedMonkey 2024-08-20 19:56:17 -04:00
parent 51da48d937
commit 8494388324
7 changed files with 15 additions and 16 deletions

View File

@ -6,16 +6,16 @@ use crate::VarInt;
#[derive(Serialize)]
#[packet(0x5A)]
pub struct CEntityVelocity<'a> {
entitiy_id: &'a VarInt,
entity_id: &'a VarInt,
velocity_x: i16,
velocity_y: i16,
velocity_z: i16,
}
impl<'a> CEntityVelocity<'a> {
pub fn new(entitiy_id: &'a VarInt, velocity_x: f32, velocity_y: f32, velocity_z: f32) -> Self {
pub fn new(entity_id: &'a VarInt, velocity_x: f32, velocity_y: f32, velocity_z: f32) -> Self {
Self {
entitiy_id,
entity_id,
velocity_x: (velocity_x.clamp(-3.9, 3.9) * 8000.0) as i16,
velocity_y: (velocity_y.clamp(-3.9, 3.9) * 8000.0) as i16,
velocity_z: (velocity_z.clamp(-3.9, 3.9) * 8000.0) as i16,

View File

@ -6,12 +6,12 @@ use crate::VarInt;
#[derive(Serialize)]
#[packet(0x24)]
pub struct CHurtAnimation<'a> {
entitiy_id: &'a VarInt,
entity_id: &'a VarInt,
yaw: f32,
}
impl<'a> CHurtAnimation<'a> {
pub fn new(entitiy_id: &'a VarInt, yaw: f32) -> Self {
Self { entitiy_id, yaw }
pub fn new(entity_id: &'a VarInt, yaw: f32) -> Self {
Self { entity_id, yaw }
}
}

View File

@ -7,14 +7,14 @@ use crate::VarInt;
#[packet(0x42)]
pub struct CRemoveEntities<'a> {
count: VarInt,
entitiy_ids: &'a [VarInt],
entity_ids: &'a [VarInt],
}
impl<'a> CRemoveEntities<'a> {
pub fn new(entitiy_ids: &'a [VarInt]) -> Self {
pub fn new(entity_ids: &'a [VarInt]) -> Self {
Self {
count: VarInt(entitiy_ids.len() as i32),
entitiy_ids,
count: VarInt(entity_ids.len() as i32),
entity_ids,
}
}
}

View File

@ -31,7 +31,6 @@ mod c_subtitle;
mod c_sync_player_position;
mod c_system_chat_message;
mod c_unload_chunk;
mod c_update_entitiy_pos_rot;
mod c_update_entity_pos;
mod c_update_entity_rot;
mod c_worldevent;
@ -70,8 +69,8 @@ pub use c_subtitle::*;
pub use c_sync_player_position::*;
pub use c_system_chat_message::*;
pub use c_unload_chunk::*;
pub use c_update_entitiy_pos_rot::*;
pub use c_update_entity_pos::*;
pub use c_update_entity_pos_rot::*;
pub use c_update_entity_rot::*;
pub use c_worldevent::*;
pub use player_action::*;

View File

@ -5,7 +5,7 @@ use crate::{bytebuf::DeserializerError, ServerPacket, VarInt};
#[packet(0x25)]
pub struct SPlayerCommand {
pub entitiy_id: VarInt,
pub entity_id: VarInt,
pub action: VarInt,
pub jump_boost: VarInt,
}
@ -25,7 +25,7 @@ pub enum Action {
impl ServerPacket for SPlayerCommand {
fn read(bytebuf: &mut crate::bytebuf::ByteBuffer) -> Result<Self, DeserializerError> {
Ok(Self {
entitiy_id: bytebuf.get_var_int(),
entity_id: bytebuf.get_var_int(),
action: bytebuf.get_var_int(),
jump_boost: bytebuf.get_var_int(),
})

View File

@ -176,7 +176,7 @@ impl Client {
pub fn handle_player_command(&mut self, _server: &mut Server, command: SPlayerCommand) {
let player = self.player.as_mut().unwrap();
if command.entitiy_id != player.entity.entity_id.into() {
if command.entity_id != player.entity.entity_id.into() {
return;
}
@ -317,7 +317,7 @@ impl Client {
}
if config.swing {}
} else {
self.kick("Interacted with invalid entitiy id")
self.kick("Interacted with invalid entity id")
}
}
}