/// If the global palette is in use, convert it to a section palette.
/// This is used for chunk saving.
If the global palette is in use, convert it to a section palette.
This is used for chunk saving.
If the global palette is in use convert it to a section palette . This is used for chunk saving .
pub fn convert_palette_to_section(&mut self) {
        if self.palette.is_some() {
            // Nothing to do: section palette already in use.
            return;
        }
        let mut blocks = MultiMap::with_capacity(1024);
        for x in 0..16 {
            for y in 0..16 {
                for z in 0..16 {
                    blocks.insert(self.block_at(x, y, z), (x, y, z));
                }
            }
        }
        // Create a palette based on the blocks in the chunk.
        // We also have to modify the data array based on the new palette.
        let mut palette = Vec::with_capacity(1024);
        for (block, positions) in blocks.into_iter() {
            palette.push(block.native_state_id());
            for (x, y, z) in positions {
                let index = block_index(x, y, z);
                self.data.set(index, (palette.len() - 1) as u64);
            }
        }
        self.palette = Some(palette);
    }
pub fn convert_palette_to_section ( & mut self ) { if self . palette . is_some ( ) { // Nothing to do: section palette already in use. return ; } let mut blocks = MultiMap :: with_capacity ( 1024 ) ; for x in 0 .. 16 { for y in 0 .. 16 { for z in 0 .. 16 { blocks . insert ( self . block_at ( x , y , z ) , ( x , y , z ) ) ; } } } // Create a palette based on the blocks in the chunk. // We also have to modify the data array based on the new palette. let mut palette = Vec :: with_capacity ( 1024 ) ; for ( block , positions ) in blocks . into_iter ( ) { palette . push ( block . native_state_id ( ) ) ; for ( x , y , z ) in positions { let index = block_index ( x , y , z ) ; self . data . set ( index , ( palette . len ( ) - 1 ) as u64 ) ; } } self . palette = Some ( palette ) ; }
If the global palette is in use, convert it to a section palette.
If the global palette is in use convert it to a section palette .
&mut self