fix typos 1.30 warns
This commit is contained in:
parent
7b27da995f
commit
3e0c8da7db
@ -23,15 +23,15 @@ impl CSetEntityMetadata {
|
|||||||
#[derive(Serialize, Clone)]
|
#[derive(Serialize, Clone)]
|
||||||
pub struct Metadata<T> {
|
pub struct Metadata<T> {
|
||||||
index: u8,
|
index: u8,
|
||||||
typ: VarInt,
|
r#type: VarInt,
|
||||||
value: T,
|
value: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Metadata<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 {
|
Self {
|
||||||
index,
|
index,
|
||||||
typ: VarInt(typ as i32),
|
r#type: VarInt(r#type as i32),
|
||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ pub struct CSpawnEntity {
|
|||||||
entity_id: VarInt,
|
entity_id: VarInt,
|
||||||
#[serde(with = "uuid::serde::compact")]
|
#[serde(with = "uuid::serde::compact")]
|
||||||
entity_uuid: uuid::Uuid,
|
entity_uuid: uuid::Uuid,
|
||||||
typ: VarInt,
|
r#type: VarInt,
|
||||||
position: Vector3<f64>,
|
position: Vector3<f64>,
|
||||||
pitch: u8, // angle
|
pitch: u8, // angle
|
||||||
yaw: u8, // angle
|
yaw: u8, // angle
|
||||||
@ -25,7 +25,7 @@ impl CSpawnEntity {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
entity_id: VarInt,
|
entity_id: VarInt,
|
||||||
entity_uuid: uuid::Uuid,
|
entity_uuid: uuid::Uuid,
|
||||||
typ: VarInt,
|
r#type: VarInt,
|
||||||
position: Vector3<f64>,
|
position: Vector3<f64>,
|
||||||
pitch: f32, // angle
|
pitch: f32, // angle
|
||||||
yaw: f32, // angle
|
yaw: f32, // angle
|
||||||
@ -36,7 +36,7 @@ impl CSpawnEntity {
|
|||||||
Self {
|
Self {
|
||||||
entity_id,
|
entity_id,
|
||||||
entity_uuid,
|
entity_uuid,
|
||||||
typ,
|
r#type,
|
||||||
position,
|
position,
|
||||||
pitch: (pitch * 256.0 / 360.0).floor() as u8,
|
pitch: (pitch * 256.0 / 360.0).floor() as u8,
|
||||||
yaw: (yaw * 256.0 / 360.0).floor() as u8,
|
yaw: (yaw * 256.0 / 360.0).floor() as u8,
|
||||||
|
|||||||
@ -11,7 +11,7 @@ use crate::{
|
|||||||
#[packet(PLAY_INTERACT)]
|
#[packet(PLAY_INTERACT)]
|
||||||
pub struct SInteract {
|
pub struct SInteract {
|
||||||
pub entity_id: VarInt,
|
pub entity_id: VarInt,
|
||||||
pub typ: VarInt,
|
pub r#type: VarInt,
|
||||||
pub target_position: Option<Vector3<f32>>,
|
pub target_position: Option<Vector3<f32>>,
|
||||||
pub hand: Option<VarInt>,
|
pub hand: Option<VarInt>,
|
||||||
pub sneaking: bool,
|
pub sneaking: bool,
|
||||||
@ -21,8 +21,8 @@ pub struct SInteract {
|
|||||||
impl ServerPacket for SInteract {
|
impl ServerPacket for SInteract {
|
||||||
fn read(bytebuf: &mut impl Buf) -> Result<Self, ReadingError> {
|
fn read(bytebuf: &mut impl Buf) -> Result<Self, ReadingError> {
|
||||||
let entity_id = bytebuf.try_get_var_int()?;
|
let entity_id = bytebuf.try_get_var_int()?;
|
||||||
let typ = bytebuf.try_get_var_int()?;
|
let r#type = bytebuf.try_get_var_int()?;
|
||||||
let action = ActionType::try_from(typ.0)
|
let action = ActionType::try_from(r#type.0)
|
||||||
.map_err(|_| ReadingError::Message("invalid action type".to_string()))?;
|
.map_err(|_| ReadingError::Message("invalid action type".to_string()))?;
|
||||||
let target_position: Option<Vector3<f32>> = match action {
|
let target_position: Option<Vector3<f32>> = match action {
|
||||||
ActionType::Interact => None,
|
ActionType::Interact => None,
|
||||||
@ -41,7 +41,7 @@ impl ServerPacket for SInteract {
|
|||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
entity_id,
|
entity_id,
|
||||||
typ,
|
r#type,
|
||||||
target_position,
|
target_position,
|
||||||
hand,
|
hand,
|
||||||
sneaking: bytebuf.try_get_bool()?,
|
sneaking: bytebuf.try_get_bool()?,
|
||||||
|
|||||||
@ -744,7 +744,7 @@ impl Player {
|
|||||||
if entity.sneaking.load(std::sync::atomic::Ordering::Relaxed) != sneaking {
|
if entity.sneaking.load(std::sync::atomic::Ordering::Relaxed) != sneaking {
|
||||||
entity.set_sneaking(sneaking).await;
|
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;
|
self.kick(TextComponent::text("Invalid action type")).await;
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user