Skip to content

Commit

Permalink
Merge pull request #44 from StripedMonkey/spell_checker
Browse files Browse the repository at this point in the history
Spell Checker
  • Loading branch information
Snowiiii authored Aug 23, 2024
2 parents f9134b5 + 4240df8 commit 43cbd6c
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions pumpkin-protocol/src/client/play/c_entity_velocity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions pumpkin-protocol/src/client/play/c_hurt_animation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}
8 changes: 4 additions & 4 deletions pumpkin-protocol/src/client/play/c_remove_entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
4 changes: 2 additions & 2 deletions pumpkin-protocol/src/client/play/c_sync_player_position.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::VarInt;

#[derive(Serialize)]
#[packet(0x40)]
pub struct CSyncPlayerPostion {
pub struct CSyncPlayerPosition {
x: f64,
y: f64,
z: f64,
Expand All @@ -15,7 +15,7 @@ pub struct CSyncPlayerPostion {
teleport_id: VarInt,
}

impl CSyncPlayerPostion {
impl CSyncPlayerPosition {
pub fn new(
x: f64,
y: f64,
Expand Down
4 changes: 2 additions & 2 deletions pumpkin-protocol/src/client/play/c_system_chat_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ use serde::Serialize;

#[derive(Serialize)]
#[packet(0x6C)]
pub struct CSystemChatMessge<'a> {
pub struct CSystemChatMessage<'a> {
content: TextComponent<'a>,
overlay: bool,
}

impl<'a> CSystemChatMessge<'a> {
impl<'a> CSystemChatMessage<'a> {
pub fn new(content: TextComponent<'a>, overlay: bool) -> Self {
Self { content, overlay }
}
Expand Down
4 changes: 2 additions & 2 deletions pumpkin-protocol/src/client/play/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ 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_pos_rot;
mod c_update_entity_rot;
mod c_worldevent;
mod player_action;
Expand Down Expand Up @@ -70,8 +70,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::*;
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub enum PacketError {
#[error("packet length is out of bounds")]
OutOfBounds,
#[error("malformed packet length VarInt")]
MailformedLength,
MalformedLength,
}

#[derive(Debug, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion pumpkin-protocol/src/packet_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl PacketDecoder {
let packet_len = match VarInt::decode_partial(&mut r) {
Ok(len) => len,
Err(VarIntDecodeError::Incomplete) => return Ok(None),
Err(VarIntDecodeError::TooLarge) => Err(PacketError::MailformedLength)?,
Err(VarIntDecodeError::TooLarge) => Err(PacketError::MalformedLength)?,
};

if !(0..=MAX_PACKET_SIZE).contains(&packet_len) {
Expand Down
4 changes: 2 additions & 2 deletions pumpkin-protocol/src/server/play/s_chat_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct SChatMessage {
pub timestamp: i64,
pub salt: i64,
pub signature: Option<Bytes>,
pub messagee_count: VarInt,
pub message_count: VarInt,
pub acknowledged: FixedBitSet,
}

Expand All @@ -25,7 +25,7 @@ impl ServerPacket for SChatMessage {
timestamp: bytebuf.get_i64(),
salt: bytebuf.get_i64(),
signature: bytebuf.get_option(|v| v.copy_to_bytes(256)),
messagee_count: bytebuf.get_var_int(),
message_count: bytebuf.get_var_int(),
acknowledged: bytebuf.get_fixed_bitset(20),
})
}
Expand Down
8 changes: 4 additions & 4 deletions pumpkin-protocol/src/server/play/s_player_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -16,16 +16,16 @@ pub enum Action {
LeaveBed,
StartSprinting,
StopSprinting,
StartHourseJump,
StopHourseJump,
StartHorseJump,
StopHorseJump,
OpenVehicleInventory,
StartFlyingElytra,
}

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(),
})
Expand Down
6 changes: 3 additions & 3 deletions pumpkin/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use pumpkin_protocol::{
client::{
config::CConfigDisconnect,
login::CLoginDisconnect,
play::{CGameEvent, CPlayDisconnect, CSyncPlayerPostion, CSystemChatMessge},
play::{CGameEvent, CPlayDisconnect, CSyncPlayerPosition, CSystemChatMessage},
},
packet_decoder::PacketDecoder,
packet_encoder::PacketEncoder,
Expand Down Expand Up @@ -160,7 +160,7 @@ impl Client {
entity.yaw = yaw;
entity.pitch = pitch;
player.awaiting_teleport = Some(id.into());
self.send_packet(&CSyncPlayerPostion::new(x, y, z, yaw, pitch, 0, id.into()));
self.send_packet(&CSyncPlayerPosition::new(x, y, z, yaw, pitch, 0, id.into()));
}

pub fn update_health(&mut self, health: f32, food: i32, food_saturation: f32) {
Expand Down Expand Up @@ -362,7 +362,7 @@ impl Client {
}

pub fn send_system_message(&mut self, text: TextComponent) {
self.send_packet(&CSystemChatMessge::new(text, false));
self.send_packet(&CSystemChatMessage::new(text, false));
}

/// Kicks the Client with a reason depending on the connection state
Expand Down
8 changes: 4 additions & 4 deletions pumpkin/src/client/player_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -187,8 +187,8 @@ impl Client {
pumpkin_protocol::server::play::Action::LeaveBed => todo!(),
pumpkin_protocol::server::play::Action::StartSprinting => player.sprinting = true,
pumpkin_protocol::server::play::Action::StopSprinting => player.sprinting = false,
pumpkin_protocol::server::play::Action::StartHourseJump => todo!(),
pumpkin_protocol::server::play::Action::StopHourseJump => todo!(),
pumpkin_protocol::server::play::Action::StartHorseJump => todo!(),
pumpkin_protocol::server::play::Action::StopHorseJump => todo!(),
pumpkin_protocol::server::play::Action::OpenVehicleInventory => todo!(),
pumpkin_protocol::server::play::Action::StartFlyingElytra => {} // TODO
}
Expand Down Expand Up @@ -317,7 +317,7 @@ impl Client {
}
if config.swing {}
} else {
self.kick("Interacted with invalid entitiy id")
self.kick("Interacted with invalid entity id")
}
}
}
Expand Down

0 comments on commit 43cbd6c

Please sign in to comment.