// We can't reuse `add` from below because chunk palettes allow for duplicates
// (because they differentiate between block states, which we ignore here)
We can't reuse `add` from below because chunk palettes allow for duplicates
(because they differentiate between block states, which we ignore here)
We can ' t reuse ` add ` from below because chunk palettes allow for duplicates ( because they differentiate between block states which we ignore here )
pub fn from_nbt(nbt: Vec<&CompoundTag>) -> Self {
        let mut elements = Vec::with_capacity(nbt.len());
        if nbt.is_empty() {
            elements.push("minecraft:air".to_string());
        }
        nbt.into_iter().enumerate().for_each(|(index, entry)| {
            let blockstate = parse_palette_entry(entry);
            // Vanilla minecraft will implicitly have id 0 = minecraft:air
            // even if it's not specified
            if index == 0 && blockstate != "minecraft:air" {
                elements.push("minecraft:air".to_string());
            }
            elements.push(blockstate.to_string());
        });
        Palette { elements }
    }
pub fn from_nbt ( nbt : Vec < & CompoundTag > ) -> Self { let mut elements = Vec :: with_capacity ( nbt . len ( ) ) ; if nbt . is_empty ( ) { elements . push ( " " . to_string ( ) ) ; } nbt . into_iter ( ) . enumerate ( ) . for_each ( | ( index , entry ) | { let blockstate = parse_palette_entry ( entry ) ; // Vanilla minecraft will implicitly have id 0 = minecraft:air // even if it's not specified if index == 0 && blockstate != " " { elements . push ( " " . to_string ( ) ) ; } elements . push ( blockstate . to_string ( ) ) ; } ) ; Palette { elements } }
We can't reuse `add` from below because chunk palettes allow for duplicates
(because they differentiate between block states, which we ignore here)
We can ' t reuse ` add ` from below because chunk palettes allow for duplicates ( because they differentiate between block states which we ignore here )
nbt
Vec<&CompoundTag>