From 09c399cff92a4866209be03bbc952dfe96f5dc9e Mon Sep 17 00:00:00 2001 From: SzczurekYT Date: Sun, 7 Apr 2024 15:31:17 +0200 Subject: [PATCH] feat: Nice put method --- src/nbt/compound.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/nbt/compound.rs b/src/nbt/compound.rs index 9980e17..f9520a1 100644 --- a/src/nbt/compound.rs +++ b/src/nbt/compound.rs @@ -50,6 +50,10 @@ impl NbtCompound { bytes.freeze() } + pub fn put(&mut self, name: String, value: impl Into) { + self.child_tags.insert(name, value.into()); + } + pub fn get_byte(&self, name: &str) -> Option { self.child_tags.get(name).and_then(|tag| tag.extract_byte()) }