aboutsummaryrefslogtreecommitdiff
path: root/azalea-physics/src/collision
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2026-01-13 10:51:30 -0600
committerGitHub <noreply@github.com>2026-01-13 10:51:30 -0600
commitd5fa5e32b37754b3b5c136e58821e48cd3b7c2ff (patch)
treeea04702f96ad170fb1d90e5ed2dc875ae8166495 /azalea-physics/src/collision
parentefb36d5fc0fe56a98f5795c53dfa109887cd5aae (diff)
downloadazalea-drasl-d5fa5e32b37754b3b5c136e58821e48cd3b7c2ff.tar.xz
Rename Instance to World (#304)
Diffstat (limited to 'azalea-physics/src/collision')
-rw-r--r--azalea-physics/src/collision/entity_collisions.rs6
-rw-r--r--azalea-physics/src/collision/mod.rs10
-rw-r--r--azalea-physics/src/collision/world_collisions.rs12
3 files changed, 14 insertions, 14 deletions
diff --git a/azalea-physics/src/collision/entity_collisions.rs b/azalea-physics/src/collision/entity_collisions.rs
index de70b2b9..5933f2d3 100644
--- a/azalea-physics/src/collision/entity_collisions.rs
+++ b/azalea-physics/src/collision/entity_collisions.rs
@@ -3,7 +3,7 @@ use azalea_entity::{
Physics,
metadata::{AbstractBoat, Shulker},
};
-use azalea_world::Instance;
+use azalea_world::World;
use bevy_ecs::{
component::Component,
entity::Entity,
@@ -51,7 +51,7 @@ pub fn update_last_bounding_box(
}
pub fn get_entity_collisions(
- world: &Instance,
+ world: &World,
aabb: &Aabb,
source_entity: Option<Entity>,
aabb_query: &AabbQuery,
@@ -83,7 +83,7 @@ pub fn get_entity_collisions(
/// `source_entity` is the entity that the bounding box belongs to, and won't be
/// one of the returned entities.
pub fn get_entities(
- world: &Instance,
+ world: &World,
source_entity: Option<Entity>,
aabb: &Aabb,
predicate: &dyn Fn(Entity) -> bool,
diff --git a/azalea-physics/src/collision/mod.rs b/azalea-physics/src/collision/mod.rs
index f720fdba..430b91ad 100644
--- a/azalea-physics/src/collision/mod.rs
+++ b/azalea-physics/src/collision/mod.rs
@@ -19,7 +19,7 @@ use azalea_entity::{
metadata::Sprinting,
};
use azalea_registry::builtin::BlockKind;
-use azalea_world::{ChunkStorage, Instance};
+use azalea_world::{ChunkStorage, World};
use bevy_ecs::{entity::Entity, world::Mut};
pub use blocks::BlockWithShape;
pub use discrete_voxel_shape::*;
@@ -110,7 +110,7 @@ fn collide(ctx: &MoveCtx, movement: Vec3) -> Vec3 {
pub struct MoveCtx<'world, 'state, 'a, 'b> {
pub mover_type: MoverType,
- pub world: &'a Instance,
+ pub world: &'a World,
pub position: Mut<'a, Position>,
pub physics: &'a mut Physics,
pub source_entity: Entity,
@@ -338,7 +338,7 @@ fn is_above_ground(ctx: &CanFallAtLeastCtx, max_up_step: f32) -> bool {
pub struct CanFallAtLeastCtx<'world, 'state, 'a, 'b> {
physics: &'a Physics,
- world: &'a Instance,
+ world: &'a World,
source_entity: Entity,
aabb_query: &'a AabbQuery<'world, 'state, 'b>,
collidable_entity_query: &'a CollidableEntityQuery<'world, 'state>,
@@ -377,7 +377,7 @@ fn can_fall_at_least(
fn collide_bounding_box(
movement: Vec3,
entity_bounding_box: &Aabb,
- world: &Instance,
+ world: &World,
entity_collisions: &[VoxelShape],
) -> Vec3 {
let mut collision_boxes: Vec<VoxelShape> = Vec::with_capacity(entity_collisions.len() + 1);
@@ -437,7 +437,7 @@ fn collide_with_shapes(
/// Get the [`VoxelShape`] for the given fluid state.
///
-/// The instance and position are required so it can check if the block above is
+/// The world and position are required so it can check if the block above is
/// also the same fluid type.
pub fn fluid_shape(fluid: &FluidState, world: &ChunkStorage, pos: BlockPos) -> &'static VoxelShape {
if fluid.amount == 9 {
diff --git a/azalea-physics/src/collision/world_collisions.rs b/azalea-physics/src/collision/world_collisions.rs
index cd883649..36a085de 100644
--- a/azalea-physics/src/collision/world_collisions.rs
+++ b/azalea-physics/src/collision/world_collisions.rs
@@ -7,14 +7,14 @@ use azalea_core::{
position::{BlockPos, ChunkBlockPos, ChunkPos, ChunkSectionBlockPos, ChunkSectionPos, Vec3},
};
use azalea_inventory::ItemStack;
-use azalea_world::{Chunk, Instance};
+use azalea_world::{Chunk, World};
use bevy_ecs::entity::Entity;
use parking_lot::RwLock;
use super::{BLOCK_SHAPE, Shapes};
use crate::collision::{Aabb, BlockWithShape, VoxelShape};
-pub fn get_block_collisions(world: &Instance, aabb: &Aabb) -> Vec<VoxelShape> {
+pub fn get_block_collisions(world: &World, aabb: &Aabb) -> Vec<VoxelShape> {
let mut state = BlockCollisionsState::new(world, aabb, EntityCollisionContext::of(None));
let mut block_collisions = Vec::new();
@@ -34,7 +34,7 @@ pub fn get_block_collisions(world: &Instance, aabb: &Aabb) -> Vec<VoxelShape> {
block_collisions
}
-pub fn get_block_and_liquid_collisions(world: &Instance, aabb: &Aabb) -> Vec<VoxelShape> {
+pub fn get_block_and_liquid_collisions(world: &World, aabb: &Aabb) -> Vec<VoxelShape> {
let mut state = BlockCollisionsState::new(
world,
aabb,
@@ -59,7 +59,7 @@ pub fn get_block_and_liquid_collisions(world: &Instance, aabb: &Aabb) -> Vec<Vox
}
pub struct BlockCollisionsState<'a> {
- pub world: &'a Instance,
+ pub world: &'a World,
pub aabb: &'a Aabb,
pub entity_shape: VoxelShape,
pub cursor: Cursor3d,
@@ -126,7 +126,7 @@ impl<'a> BlockCollisionsState<'a> {
block_collisions.push(block_shape);
}
- pub fn new(world: &'a Instance, aabb: &'a Aabb, context: EntityCollisionContext) -> Self {
+ pub fn new(world: &'a World, aabb: &'a Aabb, context: EntityCollisionContext) -> Self {
let origin = BlockPos {
x: (aabb.min.x - EPSILON).floor() as i32 - 1,
y: (aabb.min.y - EPSILON).floor() as i32 - 1,
@@ -283,7 +283,7 @@ impl CanStandOnFluidPredicate {
/// a performance loss for Azalea. If this ever turns out to be a bottleneck,
/// then maybe you should try having it do that instead.
pub fn for_entities_in_chunks_colliding_with(
- world: &Instance,
+ world: &World,
aabb: &Aabb,
mut consumer: impl FnMut(ChunkPos, &HashSet<Entity>),
) {