Skip to content

Commit d486b5a

Browse files
committed
fix: address CI clippy + leaf duplicates + Bedrock leaf persistence
- biome.rs: drop redundant `as u64` cast (c is already u64; -D warnings in CI flagged clippy::unnecessary_cast). - tree.rs: remove duplicate `(0, _, -1)` column from SPRUCE_LEAVES_FILL_* and PINE_LEAVES_FILL_* (carried over from the original SPRUCE_LEAVES_FILL pattern). The duplicate produced the same leaves twice; trimming to 5 entries matches the oak/birch shape and removes wasted writes. - bedrock_block_map.rs: add explicit persistent_bit + update_bit states for mangrove_leaves and azalea_leaves (matching the cherry_leaves pattern) so Bedrock exports don't decay the new leaves. cargo clippy --all-targets --all-features -- -D warnings clean.
1 parent dc8f4bd commit d486b5a

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

src/bedrock_block_map.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,24 @@ pub fn to_bedrock_block(block: Block) -> BedrockBlock {
229229
],
230230
),
231231

232+
// Mangrove leaves with persistence (1.19+)
233+
"mangrove_leaves" => BedrockBlock::with_states(
234+
"mangrove_leaves",
235+
vec![
236+
("persistent_bit", BedrockBlockStateValue::Bool(true)),
237+
("update_bit", BedrockBlockStateValue::Bool(false)),
238+
],
239+
),
240+
241+
// Azalea leaves with persistence (1.17+)
242+
"azalea_leaves" => BedrockBlock::with_states(
243+
"azalea_leaves",
244+
vec![
245+
("persistent_bit", BedrockBlockStateValue::Bool(true)),
246+
("update_bit", BedrockBlockStateValue::Bool(false)),
247+
],
248+
),
249+
232250
// Stone slab (bottom half by default)
233251
"stone_slab" => BedrockBlock::with_states(
234252
"stone_block_slab",

src/biome.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod tests {
152152
}
153153
let longs = pack_biome_indices(&indices, 1);
154154
assert_eq!(longs.len(), 1);
155-
let expected: u64 = (0..64u64).fold(0, |acc, c| acc | (((c % 2) as u64) << c));
155+
let expected: u64 = (0..64u64).fold(0, |acc, c| acc | ((c % 2) << c));
156156
assert_eq!(longs[0] as u64, expected);
157157
}
158158

src/element_processing/tree.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,29 +85,26 @@ const OAK_LEAVES_FILL_COMPACT: [(Coord, Coord); 5] = [
8585
];
8686

8787
// Spruce — three variants. Conifer cone shape with cross pattern.
88-
const SPRUCE_LEAVES_FILL_STANDARD: [(Coord, Coord); 6] = [
88+
const SPRUCE_LEAVES_FILL_STANDARD: [(Coord, Coord); 5] = [
8989
((-1, 3, 0), (-1, 10, 0)),
9090
((0, 3, -1), (0, 10, -1)),
9191
((1, 3, 0), (1, 10, 0)),
92-
((0, 3, -1), (0, 10, -1)),
9392
((0, 3, 1), (0, 10, 1)),
9493
((0, 11, 0), (0, 11, 0)),
9594
];
9695

97-
const SPRUCE_LEAVES_FILL_TOWERING: [(Coord, Coord); 6] = [
96+
const SPRUCE_LEAVES_FILL_TOWERING: [(Coord, Coord); 5] = [
9897
((-1, 4, 0), (-1, 13, 0)),
9998
((0, 4, -1), (0, 13, -1)),
10099
((1, 4, 0), (1, 13, 0)),
101-
((0, 4, -1), (0, 13, -1)),
102100
((0, 4, 1), (0, 13, 1)),
103101
((0, 14, 0), (0, 14, 0)),
104102
];
105103

106-
const SPRUCE_LEAVES_FILL_SQUAT: [(Coord, Coord); 6] = [
104+
const SPRUCE_LEAVES_FILL_SQUAT: [(Coord, Coord); 5] = [
107105
((-1, 2, 0), (-1, 7, 0)),
108106
((0, 2, -1), (0, 7, -1)),
109107
((1, 2, 0), (1, 7, 0)),
110-
((0, 2, -1), (0, 7, -1)),
111108
((0, 2, 1), (0, 7, 1)),
112109
((0, 8, 0), (0, 8, 0)),
113110
];
@@ -231,20 +228,18 @@ const TALL_OAK_LEAVES_FILL_GIANT: [(Coord, Coord); 5] = [
231228
];
232229

233230
// Pine — two variants. Narrow conifer using spruce blocks.
234-
const PINE_LEAVES_FILL_STANDARD: [(Coord, Coord); 6] = [
231+
const PINE_LEAVES_FILL_STANDARD: [(Coord, Coord); 5] = [
235232
((-1, 5, 0), (-1, 12, 0)),
236233
((0, 5, -1), (0, 12, -1)),
237234
((1, 5, 0), (1, 12, 0)),
238-
((0, 5, -1), (0, 12, -1)),
239235
((0, 5, 1), (0, 12, 1)),
240236
((0, 13, 0), (0, 13, 0)),
241237
];
242238

243-
const PINE_LEAVES_FILL_TALL: [(Coord, Coord); 6] = [
239+
const PINE_LEAVES_FILL_TALL: [(Coord, Coord); 5] = [
244240
((-1, 6, 0), (-1, 15, 0)),
245241
((0, 6, -1), (0, 15, -1)),
246242
((1, 6, 0), (1, 15, 0)),
247-
((0, 6, -1), (0, 15, -1)),
248243
((0, 6, 1), (0, 15, 1)),
249244
((0, 16, 0), (0, 16, 0)),
250245
];

0 commit comments

Comments
 (0)