mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
fix: Entity really teleport instead only packet (#1556)
* check every hitbox onplace block, not just player * bounding_box * refactor: use get_all_at_box for placement collision * fix: use blocking entity rules for block placement * entity_blocks_block_placement for player * fix setting for flat world * fix setting for flat world * todo * entity teleport * yaw and pitch apply --------- Co-authored-by: chocodev11 <chocodev11@users.noreply.github.com>
This commit is contained in:
@@ -2025,15 +2025,22 @@ impl Entity {
|
||||
pitch: Option<f32>,
|
||||
_world: Arc<World>,
|
||||
) {
|
||||
// TODO: handle world change
|
||||
// Update server-side position and bounding box
|
||||
self.set_pos(position);
|
||||
if let Some(yaw) = yaw {
|
||||
self.yaw.store(yaw);
|
||||
}
|
||||
if let Some(pitch) = pitch {
|
||||
self.set_pitch(pitch);
|
||||
}
|
||||
self.world
|
||||
.load()
|
||||
.broadcast_packet_all(&CEntityPositionSync::new(
|
||||
self.entity_id.into(),
|
||||
position,
|
||||
Vector3::new(0.0, 0.0, 0.0),
|
||||
yaw.unwrap_or(0.0),
|
||||
pitch.unwrap_or(0.0),
|
||||
yaw.unwrap_or(self.yaw.load()),
|
||||
pitch.unwrap_or(self.pitch.load()),
|
||||
self.on_ground.load(Ordering::SeqCst),
|
||||
))
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user