pub struct BiomeColorMap(/* private fields */);Expand description
A map of biomeids to colors
This function is useful for generating pictures of biome maps.
The colors are mapped as an array, the elements corresponding to the Red
Green And blue value respectively. eg [RED, GREEN, BLUE] The map should
contain all biomes available in minecraft.
The color scheme comes from cubiomes. The color scheme in cubiomes is strongly inspired by the color scheme used in AMIDST
It’s implemented as its own type which uses an array as its backend. The array maps each biomeid number to a color. The id’s which dont map to a id are 0.
§Usage
The map is meant to use by indexing
§Examples
// Modify a specific biomes color from the default
use cubiomes::{enums::BiomeID, colors::BiomeColorMap};
let mut color_map = BiomeColorMap::default();
let new_color = [0, 120, 255];
color_map[BiomeID::badlands] = new_color;
assert_eq!(color_map[BiomeID::badlands], new_color);§Details
The arraymap approach was benchmarked to be faster than a map type. If you
still desire a seperate map type you can use new_biome_color_map()
instead.
Implementations§
Source§impl BiomeColorMap
impl BiomeColorMap
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new BiomeColorMap with colors from cubiomes.
Sourcepub fn get_mut(&mut self, idx: BiomeID) -> &mut [u8; 3]
pub fn get_mut(&mut self, idx: BiomeID) -> &mut [u8; 3]
Gets a mutable reference to a specific BiomeID’s color.
The function can be used to mutate the color map
Trait Implementations§
Source§impl Clone for BiomeColorMap
impl Clone for BiomeColorMap
Source§fn clone(&self) -> BiomeColorMap
fn clone(&self) -> BiomeColorMap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more