aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src/collision/mod.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2025-03-16 13:41:17 -0500
committerGitHub <noreply@github.com>2025-03-16 13:41:17 -0500
commitb0bd992adcff71ee294dd05060e00e652f62a7b2 (patch)
tree0a36d8b37befbc75c8c65cc2c8779c3df66bd87b /azalea-physics/src/collision/mod.rs
parenta95408cbcc05b5bd04a084b0a286b571069206f6 (diff)
downloadazalea-drasl-b0bd992adcff71ee294dd05060e00e652f62a7b2.tar.xz
Fluid physics fixes (#210)
* start fixing code related to fluid physics * implement force_solid for blocks * afk pool test
Diffstat (limited to 'azalea-physics/src/collision/mod.rs')
-rw-r--r--azalea-physics/src/collision/mod.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs
index 540cf7d4..77af1232 100644
--- a/azalea-physics/src/collision/mod.rs
+++ b/azalea-physics/src/collision/mod.rs
@@ -1,8 +1,9 @@
mod blocks;
mod discrete_voxel_shape;
+pub mod entity_collisions;
mod mergers;
mod shape;
-mod world_collisions;
+pub mod world_collisions;
use std::{ops::Add, sync::LazyLock};
@@ -279,7 +280,7 @@ fn collide_bounding_box(
// TODO: world border
let block_collisions =
- get_block_collisions(world, entity_bounding_box.expand_towards(movement));
+ get_block_collisions(world, &entity_bounding_box.expand_towards(movement));
collision_boxes.extend(block_collisions);
collide_with_shapes(movement, *entity_bounding_box, &collision_boxes)
}
@@ -392,6 +393,11 @@ fn calculate_shape_for_fluid(amount: u8) -> VoxelShape {
///
/// This is marked as deprecated in Minecraft.
pub fn legacy_blocks_motion(block: BlockState) -> bool {
+ if block == BlockState::AIR {
+ // fast path
+ return false;
+ }
+
let registry_block = azalea_registry::Block::from(block);
legacy_calculate_solid(block)
&& registry_block != azalea_registry::Block::Cobweb