Skip to content

Commit

Permalink
Tweak valence_nbt (#430)
Browse files Browse the repository at this point in the history
# Objective

- Fix a few small things before releasing 0.5. For #428 

# Solution

- Remove redundant `element_type` method from `Tag`.
- `get_tag` -> `tag`.
- Remove macro generated methods from `Value`.
- Create `From<Value> for List` impl which creates a new singleton list.
- Clean up snbt code a bit.
  • Loading branch information
rj00a authored Jul 31, 2023
1 parent 3af9472 commit 4eb2654
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 172 deletions.
1 change: 1 addition & 0 deletions crates/valence_nbt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ version = "0.5.0"
edition.workspace = true

[features]
default = ["snbt"] # TODO: remove me
binary = ["dep:byteorder", "dep:cesu8"]
snbt = []
# When enabled, the order of fields in compounds are preserved.
Expand Down
2 changes: 1 addition & 1 deletion crates/valence_nbt/src/binary/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl<W: Write> EncodeState<W> {

fn write_compound(&mut self, c: &Compound) -> Result<()> {
for (k, v) in c.iter() {
self.write_tag(Tag::element_type(v))?;
self.write_tag(v.tag())?;
self.write_string(k)?;
self.write_value(v)?;
}
Expand Down
Loading

0 comments on commit 4eb2654

Please sign in to comment.