Skip to content

Commit

Permalink
fix typos 1.30 warns
Browse files Browse the repository at this point in the history
  • Loading branch information
Snowiiii committed Mar 3, 2025
1 parent 7b27da9 commit 3e0c8da
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pumpkin-protocol/src/client/play/entity_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ impl CSetEntityMetadata {
#[derive(Serialize, Clone)]
pub struct Metadata<T> {
index: u8,
typ: VarInt,
r#type: VarInt,
value: T,
}

impl<T> Metadata<T> {
pub fn new(index: u8, typ: MetaDataType, value: T) -> Self {
pub fn new(index: u8, r#type: MetaDataType, value: T) -> Self {
Self {
index,
typ: VarInt(typ as i32),
r#type: VarInt(r#type as i32),
value,
}
}
Expand Down
6 changes: 3 additions & 3 deletions pumpkin-protocol/src/client/play/spawn_entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct CSpawnEntity {
entity_id: VarInt,
#[serde(with = "uuid::serde::compact")]
entity_uuid: uuid::Uuid,
typ: VarInt,
r#type: VarInt,
position: Vector3<f64>,
pitch: u8, // angle
yaw: u8, // angle
Expand All @@ -25,7 +25,7 @@ impl CSpawnEntity {
pub fn new(
entity_id: VarInt,
entity_uuid: uuid::Uuid,
typ: VarInt,
r#type: VarInt,
position: Vector3<f64>,
pitch: f32, // angle
yaw: f32, // angle
Expand All @@ -36,7 +36,7 @@ impl CSpawnEntity {
Self {
entity_id,
entity_uuid,
typ,
r#type,
position,
pitch: (pitch * 256.0 / 360.0).floor() as u8,
yaw: (yaw * 256.0 / 360.0).floor() as u8,
Expand Down
8 changes: 4 additions & 4 deletions pumpkin-protocol/src/server/play/interact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
#[packet(PLAY_INTERACT)]
pub struct SInteract {
pub entity_id: VarInt,
pub typ: VarInt,
pub r#type: VarInt,
pub target_position: Option<Vector3<f32>>,
pub hand: Option<VarInt>,
pub sneaking: bool,
Expand All @@ -21,8 +21,8 @@ pub struct SInteract {
impl ServerPacket for SInteract {
fn read(bytebuf: &mut impl Buf) -> Result<Self, ReadingError> {
let entity_id = bytebuf.try_get_var_int()?;
let typ = bytebuf.try_get_var_int()?;
let action = ActionType::try_from(typ.0)
let r#type = bytebuf.try_get_var_int()?;
let action = ActionType::try_from(r#type.0)
.map_err(|_| ReadingError::Message("invalid action type".to_string()))?;
let target_position: Option<Vector3<f32>> = match action {
ActionType::Interact => None,
Expand All @@ -41,7 +41,7 @@ impl ServerPacket for SInteract {

Ok(Self {
entity_id,
typ,
r#type,
target_position,
hand,
sneaking: bytebuf.try_get_bool()?,
Expand Down
2 changes: 1 addition & 1 deletion pumpkin/src/net/packet/play.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ impl Player {
if entity.sneaking.load(std::sync::atomic::Ordering::Relaxed) != sneaking {
entity.set_sneaking(sneaking).await;
}
let Ok(action) = ActionType::try_from(interact.typ.0) else {
let Ok(action) = ActionType::try_from(interact.r#type.0) else {
self.kick(TextComponent::text("Invalid action type")).await;
return;
};
Expand Down

0 comments on commit 3e0c8da

Please sign in to comment.