diff options
| author | mat <git@matdoes.dev> | 2023-10-02 20:59:51 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-10-02 20:59:51 -0500 |
| commit | 0691373310676768ef5268daef0e03b583c2cbe9 (patch) | |
| tree | c8c3de4fb80dc07aee1555f993f537030f1be813 | |
| parent | 985327241d341caf2ce357955cb46657cfa303cb (diff) | |
| download | azalea-drasl-0691373310676768ef5268daef0e03b583c2cbe9.tar.xz | |
cleanup
| -rwxr-xr-x | azalea-block/src/lib.rs | 1 | ||||
| -rwxr-xr-x | azalea-world/src/chunk_storage.rs | 2 | ||||
| -rw-r--r-- | azalea/src/pathfinder/mod.rs | 2 | ||||
| -rw-r--r-- | azalea/src/pathfinder/moves/mod.rs | 4 |
4 files changed, 5 insertions, 4 deletions
diff --git a/azalea-block/src/lib.rs b/azalea-block/src/lib.rs index ef0041f1..f95a4f2f 100755 --- a/azalea-block/src/lib.rs +++ b/azalea-block/src/lib.rs @@ -53,6 +53,7 @@ impl BlockState { state_id <= Self::max_state() } + #[inline] pub fn is_air(&self) -> bool { self == &Self::AIR } diff --git a/azalea-world/src/chunk_storage.rs b/azalea-world/src/chunk_storage.rs index acf0cf22..e7ff40c5 100755 --- a/azalea-world/src/chunk_storage.rs +++ b/azalea-world/src/chunk_storage.rs @@ -315,6 +315,7 @@ impl Chunk { /// Get the block state at the given position from a list of sections. Returns /// `None` if the position is out of bounds. +#[inline] pub fn get_block_state_from_sections( sections: &[Section], pos: &ChunkBlockPos, @@ -329,7 +330,6 @@ pub fn get_block_state_from_sections( // y position is out of bounds return None; }; - // TODO: make sure the section exists let section = §ions[section_index]; let chunk_section_pos = ChunkSectionBlockPos::from(pos); Some(section.get(chunk_section_pos)) diff --git a/azalea/src/pathfinder/mod.rs b/azalea/src/pathfinder/mod.rs index 74b4342f..f4d16ca5 100644 --- a/azalea/src/pathfinder/mod.rs +++ b/azalea/src/pathfinder/mod.rs @@ -194,7 +194,7 @@ fn goto_listener( |n| goal.heuristic(n), successors, |n| goal.success(n), - Duration::from_secs(if attempt_number == 0 { 10 } else { 10 }), + Duration::from_secs(if attempt_number == 0 { 1 } else { 5 }), ); let end_time = std::time::Instant::now(); debug!("partial: {partial:?}"); diff --git a/azalea/src/pathfinder/moves/mod.rs b/azalea/src/pathfinder/moves/mod.rs index 907db4fc..39e5374f 100644 --- a/azalea/src/pathfinder/moves/mod.rs +++ b/azalea/src/pathfinder/moves/mod.rs @@ -48,6 +48,7 @@ impl<'a> PathfinderCtx<'a> { fn get_block_state(&self, pos: &BlockPos) -> Option<BlockState> { let chunk_pos = ChunkPos::from(pos); + let chunk_block_pos = ChunkBlockPos::from(pos); let mut cached_chunks = self.cached_chunks.borrow_mut(); if let Some(sections) = cached_chunks.iter().find_map(|(pos, sections)| { @@ -59,7 +60,7 @@ impl<'a> PathfinderCtx<'a> { }) { return azalea_world::chunk_storage::get_block_state_from_sections( sections, - &ChunkBlockPos::from(pos), + &chunk_block_pos, self.world.min_y, ); } @@ -69,7 +70,6 @@ impl<'a> PathfinderCtx<'a> { cached_chunks.push((chunk_pos, chunk.sections.clone())); - let chunk_block_pos = ChunkBlockPos::from(pos); azalea_world::chunk_storage::get_block_state_from_sections( &chunk.sections, &chunk_block_pos, |
