GlobalBiomes

Struct GlobalBiomes 

Source
pub struct GlobalBiomes { /* private fields */ }
Expand description

This is a global biomes palette, it is used in chunk storage to store biomes. It allows you to register individual biomes in it as well as static biomes arrays defined using the macro biomes!.

Implementations§

Source§

impl GlobalBiomes

Source

pub fn new() -> Self

Source

pub fn with_all(slice: &[&'static Biome]) -> Result<Self, ()>

A simple constructor to directly call register_all with given biomes slice.

Source

pub fn register(&mut self, biome: &'static Biome) -> Result<(), ()>

Register a single biome to this palette, returns Err if no more save ID (SID) is available, Ok is returned if successful, if a biome was already in the palette it also returns Ok.

Source

pub fn register_all(&mut self, slice: &[&'static Biome]) -> Result<(), ()>

An optimized way to call register multiple times for each given biome, the returned follow the same rules as register, if an error happens, it return without and previous added biomes are kept.

Source

pub fn get_sid_from(&self, biome: &'static Biome) -> Option<u16>

Source

pub fn get_biome_from(&self, sid: u16) -> Option<&'static Biome>

Source

pub fn get_biome_from_name(&self, name: &str) -> Option<&'static Biome>

Source

pub fn get_biome_from_id(&self, id: i32) -> Option<&'static Biome>

Source

pub fn has_biome(&self, biome: &'static Biome) -> bool

Source

pub fn check_biome<E>( &self, biome: &'static Biome, err: impl FnOnce() -> E, ) -> Result<&'static Biome, E>

Source

pub fn biomes_count(&self) -> usize

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Component for T
where T: Send + Sync + 'static,