Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JieningYu committed Aug 15, 2023
1 parent 464af1c commit a9e87af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions core/src/world/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ impl<'w> Section<'w> {

pub fn calculate_counts(&self) {
let mut counter = BlockStateCounter::default();
self.block_state_container.count(&mut counter);

{
let ptr = &mut counter as *mut BlockStateCounter;
self.block_state_container
.count(|value, count| unsafe { &mut *ptr }.accept(value, count));
}

self.non_empty_block_count
.store(counter.non_empty_block_count, atomic::Ordering::Release);
Expand All @@ -181,9 +186,7 @@ struct BlockStateCounter {
random_tickable_block_count: u16,
}

impl BlockStateCounter {}

impl palette::ContainerCounter<block::SharedBlockState> for BlockStateCounter {
impl BlockStateCounter {
fn accept(&mut self, value: block::SharedBlockState, count: usize) {
let fs = value.fluid_state();

Expand Down
2 changes: 1 addition & 1 deletion core/src/world/palette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ impl DataProvider {
Data(
self,
if self.1 == 0 {
Storage::new(32, len, None)
Storage::new(1, len, None)
} else {
Storage::new(self.1, len, None)
},
Expand Down

0 comments on commit a9e87af

Please sign in to comment.