Pumpkin/pumpkin-world/src/world_gen/seed.rs
Alexander Medvedev b40c2fa988 Add Experimental Plains biome
Also add Perlin noise
2024-09-06 17:54:14 +01:00

16 lines
424 B
Rust

use std::hash::{DefaultHasher, Hash, Hasher};
#[derive(Clone, Copy)]
pub struct Seed(pub i64);
impl From<&str> for Seed {
fn from(value: &str) -> Self {
// TODO replace with a deterministic hasher (the same as vanilla?)
let mut hasher = DefaultHasher::new();
value.hash(&mut hasher);
// TODO use cast_signed once the feature is stabilized.
Self(hasher.finish() as i64)
}
}