minior position/rotation improvements
This commit is contained in:
1 parent
e96f072951
commit
770d73f080
11 files changed
+80
-50
No files matched your search
@@ -3,7 +3,7 @@ use pumpkin_macros::packet;
|
||||
use pumpkin_text::TextComponent;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{ VarInt};
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize, Clone)]
|
||||
#[packet(0x39)]
|
||||
|
||||
@@ -12,6 +12,9 @@ pub struct CRemoveEntities {
|
||||
|
||||
impl CRemoveEntities {
|
||||
pub fn new(entitiy_ids: Vec<VarInt>) -> Self {
|
||||
Self { count: VarInt(entitiy_ids.len() as i32), entitiy_ids }
|
||||
Self {
|
||||
count: VarInt(entitiy_ids.len() as i32),
|
||||
entitiy_ids,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,13 +29,13 @@ impl CSpawnEntity {
|
||||
x: f64,
|
||||
y: f64,
|
||||
z: f64,
|
||||
pitch: u8, // angle
|
||||
yaw: u8, // angle
|
||||
head_yaw: u8, // angle
|
||||
pitch: f32, // angle
|
||||
yaw: f32, // angle
|
||||
head_yaw: f32, // angle
|
||||
data: VarInt,
|
||||
velocity_x: i16,
|
||||
velocity_y: i16,
|
||||
velocity_z: i16,
|
||||
velocity_x: f32,
|
||||
velocity_y: f32,
|
||||
velocity_z: f32,
|
||||
) -> Self {
|
||||
Self {
|
||||
entity_id,
|
||||
@@ -44,13 +44,13 @@ impl CSpawnEntity {
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
pitch,
|
||||
yaw,
|
||||
head_yaw,
|
||||
pitch: (pitch * 256.0 / 360.0).floor() as u8,
|
||||
yaw: (yaw * 256.0 / 360.0).floor() as u8,
|
||||
head_yaw: (head_yaw * 256.0 / 360.0).floor() as u8,
|
||||
data,
|
||||
velocity_x,
|
||||
velocity_y,
|
||||
velocity_z,
|
||||
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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user