chore: remove some dump unwraps
we need to remove more
This commit is contained in:
1 parent
eb8931f5f3
commit
8b418813f8
4 files changed
+8
-15
No files matched your search
@@ -327,8 +327,8 @@ impl<S: SingleChunkDataSerializer> ChunkSerializer for LinearFile<S> {
|
|||||||
header.size = chunk_raw.len() as u32;
|
header.size = chunk_raw.len() as u32;
|
||||||
header.timestamp = SystemTime::now()
|
header.timestamp = SystemTime::now()
|
||||||
.duration_since(UNIX_EPOCH)
|
.duration_since(UNIX_EPOCH)
|
||||||
.unwrap()
|
.map(|d| d.as_secs() as u32)
|
||||||
.as_secs() as u32;
|
.unwrap_or(0);
|
||||||
|
|
||||||
// We update the data buffer
|
// We update the data buffer
|
||||||
self.chunks_data[index] = Some(chunk_raw);
|
self.chunks_data[index] = Some(chunk_raw);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ impl TreeFeature {
|
|||||||
|
|
||||||
let clipped_height = self.minimum_size.min_clipped_height;
|
let clipped_height = self.minimum_size.min_clipped_height;
|
||||||
let top = self.get_top(height, chunk, pos); // TODO: roots
|
let top = self.get_top(height, chunk, pos); // TODO: roots
|
||||||
if top < height && (clipped_height.is_none() || top < clipped_height.unwrap() as u32) {
|
if top < height && top < clipped_height.map_or(u32::MAX, |h| h as u32) {
|
||||||
return vec![];
|
return vec![];
|
||||||
}
|
}
|
||||||
let trunk_state = self.trunk_provider.get(random, pos);
|
let trunk_state = self.trunk_provider.get(random, pos);
|
||||||
|
|||||||
@@ -62,14 +62,11 @@ pub async fn get_spread<T: FlowingFluid + Sync + ?Sized>(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let new_fluid_state = fluid_impl.get_new_liquid(world, fluid, &side_pos).await;
|
|
||||||
|
|
||||||
// Skip if no valid fluid state for this position
|
// Skip if no valid fluid state for this position
|
||||||
if new_fluid_state.is_none() {
|
let Some(new_fluid_props) = fluid_impl.get_new_liquid(world, fluid, &side_pos).await else {
|
||||||
continue;
|
continue;
|
||||||
}
|
};
|
||||||
|
|
||||||
let new_fluid_props = new_fluid_state.unwrap();
|
|
||||||
let new_state_id = new_fluid_props.to_state_id(fluid);
|
let new_state_id = new_fluid_props.to_state_id(fluid);
|
||||||
|
|
||||||
// Holes get distance 0
|
// Holes get distance 0
|
||||||
|
|||||||
@@ -61,11 +61,7 @@ impl FindArg<'_> for TextComponentArgConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn parse_text_component(input: &str) -> Option<TextComponent> {
|
fn parse_text_component(input: &str) -> Option<TextComponent> {
|
||||||
let result = serde_json::from_str(input);
|
serde_json::from_str(input)
|
||||||
if let Err(e) = result {
|
.map_err(|e| debug!("Failed to parse text component: {e}"))
|
||||||
debug!("Failed to parse text component: {e}");
|
.ok()
|
||||||
None
|
|
||||||
} else {
|
|
||||||
result.unwrap()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user