Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 26 additions & 84 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions feather/worldgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ bitvec = "0.21"
log = "0.4"
num-traits = "0.2"
once_cell = "1"
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.8.4"
rand_xorshift = "0.3.0"
simdnoise = { git = "https://github.com/jackmott/rust-simd-noise", rev = "3a4f3e6" } # needed for https://github.com/jackmott/rust-simd-noise/pull/31 and https://github.com/jackmott/rust-simd-noise/pull/36
smallvec = "1"
strum = "0.21"
Expand Down
2 changes: 1 addition & 1 deletion feather/worldgen/src/composition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn basic_composition_for_solid_biome(
}

if !skip {
if y <= rng.gen_range(0, 4) {
if y <= rng.gen_range(0..4) {
block = BlockId::bedrock();
} else {
block = if is_solid {
Expand Down
8 changes: 4 additions & 4 deletions feather/worldgen/src/finishers/clumped.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ impl FinishingGenerator for ClumpedFoliageFinisher {
let biome = biomes.get_at_block(x, 0, z);

if let Some(block) = biome_clump_block(biome) {
if rng.gen_range(0, 48) == 0 {
if rng.gen_range(0..48) == 0 {
// Generate clump with center at this position.
iter::repeat(()).take(rng.gen_range(3, 6)).for_each(|_| {
let offset_x = rng.gen_range(-2, 3);
let offset_z = rng.gen_range(-2, 3);
iter::repeat(()).take(rng.gen_range(3..6)).for_each(|_| {
let offset_x = rng.gen_range(-2..3);
let offset_z = rng.gen_range(-2..3);

// Clamp value within chunk border
let pos_x = cmp::max(0, cmp::min(x as i32 + offset_x, 15)) as usize;
Expand Down
2 changes: 1 addition & 1 deletion feather/worldgen/src/finishers/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl FinishingGenerator for SingleFoliageFinisher {
if let Some(foliage) = biome_foliage(biome) {
if chunk.block_at(x, top_blocks.top_block_at(x, z), z).unwrap()
== foliage.required
&& rng.gen_range(0, 192) == 0
&& rng.gen_range(0..192) == 0
{
chunk.set_block_at(x, top_blocks.top_block_at(x, z) + 1, z, foliage.block);
}
Expand Down
4 changes: 2 additions & 2 deletions feather/worldgen/src/voronoi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl VoronoiGrid {
let mut rng = XorShiftRng::seed_from_u64(
self.seed ^ (((i64::from(cell_x)) << 32) | (i64::from(cell_y))) as u64,
);
let offset = rng.gen_range(-half_length, half_length);
let offset = rng.gen_range(-half_length..half_length);

let center_x = pos_x + half_length as i32;
let center_y = pos_y + half_length as i32;
Expand All @@ -136,7 +136,7 @@ pub fn shuffle(closest_x: i32, closest_y: i32, min: usize, max: usize) -> usize

let mut rng = XorShiftRng::seed_from_u64(combined);

rng.gen_range(min, max)
rng.gen_range(min..max)
}

fn square(x: i32) -> i32 {
Expand Down