-
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Flowers - Grass - More natural height variation
- Loading branch information
Showing
5 changed files
with
150 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
pumpkin-world/src/world_gen/implementation/overworld/biome/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,55 @@ | ||
use std::ops::Add; | ||
|
||
use crate::{block::BlockState, coordinates::ChunkRelativeBlockCoordinates}; | ||
|
||
pub mod plains; | ||
|
||
pub fn generate_tree( | ||
chunk_relative_coordinates: ChunkRelativeBlockCoordinates, | ||
) -> Vec<(ChunkRelativeBlockCoordinates, BlockState)> { | ||
let x = chunk_relative_coordinates.x; | ||
let z = chunk_relative_coordinates.z; | ||
|
||
// TODO: Adjust tree height and trunk width based on biome | ||
let tree_height: i8 = 7; | ||
let trunk_width: i8 = 1; | ||
|
||
let mut tree_blocks = Vec::new(); | ||
|
||
// Generate trunk | ||
for y in 0..tree_height { | ||
for dx in 0 - trunk_width..=trunk_width { | ||
for dz in 0 - trunk_width..=trunk_width { | ||
let block_coordinates = ChunkRelativeBlockCoordinates { | ||
x: x.add(dx as u8).into(), | ||
y: (chunk_relative_coordinates.y.add(y as i16)).into(), | ||
z: z.add(dz as u8).into(), | ||
}; | ||
tree_blocks.push(( | ||
block_coordinates, | ||
pumpkin_macros::block!("minecraft:oak_log"), | ||
)); | ||
} | ||
} | ||
} | ||
|
||
// Generate leaves | ||
let leaf_radius = trunk_width + 1; | ||
for y in tree_height..tree_height + 3 { | ||
for dx in 0 - leaf_radius..=leaf_radius { | ||
for dz in 0 - leaf_radius..=leaf_radius { | ||
let block_coordinates = ChunkRelativeBlockCoordinates { | ||
x: x.add(dx as u8).into(), | ||
y: (chunk_relative_coordinates.y.add(y as i16)).into(), | ||
z: z.add(dz as u8).into(), | ||
}; | ||
tree_blocks.push(( | ||
block_coordinates, | ||
pumpkin_macros::block!("minecraft:oak_leaves"), | ||
)); | ||
} | ||
} | ||
} | ||
|
||
tree_blocks | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters