Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Oct 3, 2023
1 parent 9853272 commit 0691373
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions azalea-block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl BlockState {
state_id <= Self::max_state()
}

#[inline]
pub fn is_air(&self) -> bool {
self == &Self::AIR
}
Expand Down
2 changes: 1 addition & 1 deletion azalea-world/src/chunk_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 = &sections[section_index];
let chunk_section_pos = ChunkSectionBlockPos::from(pos);
Some(section.get(chunk_section_pos))
Expand Down
2 changes: 1 addition & 1 deletion azalea/src/pathfinder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}");
Expand Down
4 changes: 2 additions & 2 deletions azalea/src/pathfinder/moves/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)| {
Expand All @@ -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,
);
}
Expand All @@ -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,
Expand Down

0 comments on commit 0691373

Please sign in to comment.