MCPcopy Create free account
hub / github.com/HairlessVillager/minecommit / load_nbt

Function load_nbt

minecommit/src/utils/nbt.rs:6–12  ·  view source on GitHub ↗
(mut data: Cursor<&[u8]>)

Source from the content-addressed store, hash-verified

4use simdnbt::owned::{BaseNbt, Nbt, NbtCompound, NbtList, NbtTag, read};
5
6pub fn load_nbt(mut data: Cursor<&[u8]>) -> Result<BaseNbt> {
7 if let Nbt::Some(base) = read(&mut data)? {
8 Ok(base)
9 } else {
10 Err(anyhow::anyhow!("nbt data is empty"))
11 }
12}
13
14pub fn dump_nbt(nbt: BaseNbt, size: usize) -> Result<Vec<u8>> {
15 let mut buf = Vec::with_capacity(size);

Callers 6

flattenMethod · 0.85
flattenMethod · 0.85
flattenMethod · 0.85
unflattenMethod · 0.85
flattenMethod · 0.85
unflattenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected