diff --git a/azalea-block/src/range.rs b/azalea-block/src/range.rs index cbe77284..7960b5c4 100644 --- a/azalea-block/src/range.rs +++ b/azalea-block/src/range.rs @@ -47,16 +47,16 @@ impl Add for BlockStates { impl From> for BlockStates { fn from(set: HashSet) -> Self { - Self { - set: set.into_iter().map(|b| b.into()).collect(), - } + Self::from(&set) } } impl From<&HashSet> for BlockStates { fn from(set: &HashSet) -> Self { - Self { - set: set.iter().map(|&b| b.into()).collect(), + let mut block_states = HashSet::with_capacity(set.len()); + for &block in set { + block_states.extend(BlockStates::from(block)); } + Self { set: block_states } } }