def pack(self): new_sections = nbt.ListTag(nbt.CompoundTag.clazz_id, tag_name='Sections', children=[ self.sections[sec].serialize() for sec in self.sections ]) new_nbt = self.raw_nbt.clone() new_nbt.get('Level').add_child(new_sections) return new_nbt
def _serialize_palette(self): serial_palette = nbt.ListTag(nbt.CompoundTag.clazz_id, tag_name='Palette') for state in self.palette: palette_item = nbt.CompoundTag(tag_name='None', children=[ nbt.StringTag(state.name, tag_name='Name') ]) if len(state.props) != 0: serial_props = nbt.CompoundTag(tag_name='Properties') for name, val in state.props.items(): serial_props.add_child(nbt.StringTag(str(val), tag_name=name)) palette_item.add_child(serial_props) serial_palette.add_child(palette_item) return serial_palette