Skip to content

Commit

Permalink
feat: Nice put method
Browse files Browse the repository at this point in the history
  • Loading branch information
SzczurekYT authored and Norbiros committed Jun 10, 2024
1 parent adfc481 commit 09c399c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/nbt/compound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ impl NbtCompound {
bytes.freeze()
}

pub fn put(&mut self, name: String, value: impl Into<NbtTag>) {
self.child_tags.insert(name, value.into());
}

pub fn get_byte(&self, name: &str) -> Option<i8> {
self.child_tags.get(name).and_then(|tag| tag.extract_byte())
}
Expand Down

0 comments on commit 09c399c

Please sign in to comment.