mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
improve docs for biome code
This commit is contained in:
parent
2c5f293210
commit
c5ddae58a1
2 changed files with 19 additions and 2 deletions
|
@ -24,7 +24,8 @@ impl<T: DataRegistry> Registry for T {
|
|||
}
|
||||
|
||||
macro_rules! data_registry {
|
||||
($name:ident, $registry_name:expr) => {
|
||||
($(#[$doc:meta])* $name:ident, $registry_name:expr) => {
|
||||
$(#[$doc])*
|
||||
#[derive(Debug, Clone, Copy, AzBuf, PartialEq, Eq, Hash)]
|
||||
pub struct $name {
|
||||
#[var]
|
||||
|
@ -54,7 +55,15 @@ data_registry! {PigVariant, "pig_variant"}
|
|||
data_registry! {PaintingVariant, "painting_variant"}
|
||||
data_registry! {WolfVariant, "wolf_variant"}
|
||||
|
||||
data_registry! {Biome, "biome"}
|
||||
data_registry! {
|
||||
/// An opaque biome identifier.
|
||||
///
|
||||
/// You'll probably want to resolve this into its name before using it, by
|
||||
/// using `Client::with_resolved_registry` or a similar function.
|
||||
Biome,
|
||||
"worldgen/biome"
|
||||
}
|
||||
|
||||
// these extra traits are required for Biome to be allowed to be palletable
|
||||
impl Default for Biome {
|
||||
fn default() -> Self {
|
||||
|
|
|
@ -179,6 +179,14 @@ impl Instance {
|
|||
self.chunks.get_block_state(pos).map(FluidState::from)
|
||||
}
|
||||
|
||||
/// Get the biome at the given position.
|
||||
///
|
||||
/// You can then use `Client::with_resolved_registry` to get the name and
|
||||
/// data from the biome.
|
||||
///
|
||||
/// Note that biomes are internally stored as 4x4x4 blocks, so if you're
|
||||
/// writing code that searches for a specific biome it'll probably be more
|
||||
/// efficient to avoid scanning every single block.
|
||||
pub fn get_biome(&self, pos: &BlockPos) -> Option<Biome> {
|
||||
self.chunks.get_biome(pos)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue