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:
ChocoDev
2026-02-16 19:10:26 +07:00
committed by GitHub
parent 74ecc3b2a5
commit 3f170e4922

View File

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