Skip to main content

steel_core/physics/
mod.rs

1//! Physics engine for entity movement with vanilla Minecraft parity.
2//!
3//! This module implements the core physics simulation for moving entities through
4//! the world with proper collision detection, including:
5//! - Step-up mechanics (climbing blocks ≤ `max_up_step` height)
6//! - Sneak-edge prevention (staying on block edges while crouching)
7//! - VoxelShape-based collision using AABB lists
8//!
9//! The implementation closely follows vanilla's `Entity.move()` method to ensure
10//! 1:1 movement validation for anti-cheat purposes.
11
12pub mod collision;
13pub(crate) mod entity_move;
14pub mod movement_validation;
15pub(crate) mod physics_state;
16pub mod shapes;
17
18// Public API
19pub use collision::{
20    CollisionWorld, WorldCollisionProvider, has_block_collision, has_collision,
21    is_colliding_with_new_shapes,
22};
23pub(crate) use entity_move::move_entity;
24pub use entity_move::{MoveResult, MoverType};
25pub(crate) use movement_validation::ClientAuthoredMovementState;
26pub use movement_validation::{
27    MOVEMENT_ERROR_THRESHOLD, MovementCollisionValidation, movement_error_delta,
28};
29pub(crate) use physics_state::EntityPhysicsState;
30pub use shapes::{collide, join_is_not_empty, merged_face_occludes, translate_shape};
31
32/// Collision epsilon used for AABB deflation (vanilla constant).
33pub const COLLISION_EPSILON: f64 = 1.0e-5;