treewide: remove get_ prefix from function names

Follow the conventions of the std library.
This commit is contained in:
Matthias Schiffer 2023-02-12 23:36:58 +01:00
parent 96736bd7ed
commit 9f8446885e
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
2 changed files with 6 additions and 6 deletions

View file

@ -28,7 +28,7 @@ pub struct BlockType {
pub color: BlockColor, pub color: BlockColor,
} }
pub fn get_block_types() -> HashMap<String, BlockType> { pub fn block_types() -> HashMap<String, BlockType> {
block_types::BLOCK_TYPES block_types::BLOCK_TYPES
.iter() .iter()
.map(|(k, v)| (String::from(*k), *v)) .map(|(k, v)| (String::from(*k), *v))

View file

@ -24,7 +24,7 @@ fn palette_bits(len: usize, min: u8, max: u8) -> Option<u8> {
/// Trait for common functions of [SectionV1_13] and [SectionV0] /// Trait for common functions of [SectionV1_13] and [SectionV0]
pub trait Section { pub trait Section {
fn get_block_id(&self, coords: BlockCoords) -> Result<&str>; fn block_id_at(&self, coords: BlockCoords) -> Result<&str>;
} }
/// Minecraft v1.18+ section biome data /// Minecraft v1.18+ section biome data
@ -101,7 +101,7 @@ impl<'a> SectionV1_13<'a> {
} }
/// Looks up the block type palette index at the given coordinates /// Looks up the block type palette index at the given coordinates
fn get_palette_index(&self, coords: BlockCoords) -> usize { fn palette_index_at(&self, coords: BlockCoords) -> usize {
let Some(block_states) = self.block_states else { let Some(block_states) = self.block_states else {
return 0; return 0;
}; };
@ -133,8 +133,8 @@ impl<'a> SectionV1_13<'a> {
} }
impl<'a> Section for SectionV1_13<'a> { impl<'a> Section for SectionV1_13<'a> {
fn get_block_id(&self, coords: BlockCoords) -> Result<&str> { fn block_id_at(&self, coords: BlockCoords) -> Result<&str> {
let index = self.get_palette_index(coords); let index = self.palette_index_at(coords);
let entry = self let entry = self
.palette .palette
.get(index) .get(index)
@ -167,7 +167,7 @@ impl<'a> SectionV0<'a> {
} }
impl<'a> Section for SectionV0<'a> { impl<'a> Section for SectionV0<'a> {
fn get_block_id(&self, coords: BlockCoords) -> Result<&str> { fn block_id_at(&self, coords: BlockCoords) -> Result<&str> {
let offset = coords.offset(); let offset = coords.offset();
let block = self.blocks[offset] as u8; let block = self.blocks[offset] as u8;