fix typos 1.30 warns

This commit is contained in:
Alexander Medvedev
2025-03-03 09:49:25 +01:00
parent 7b27da995f
commit 3e0c8da7db
4 changed files with 11 additions and 11 deletions

View File

@@ -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,
}
}

View File

@@ -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
@@ -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
@@ -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,

View File

@@ -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,
@@ -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,
@@ -41,7 +41,7 @@ impl ServerPacket for SInteract {
Ok(Self {
entity_id,
typ,
r#type,
target_position,
hand,
sneaking: bytebuf.try_get_bool()?,

View File

@@ -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;
};