azalea/azalea-nbt
mat 634cb8d72c
Inventory (#48)
* start adding azalea-inventory

* design more of how inventories are defined

* start working on az-inv-macros

* inventory macro works

* start adding inventory codegen

* update some deps

* add inventory codegen

* manually write inventory menus

* put the inventories in Client

* start on containersetcontent

* inventory menu should hopefully work

* checks in containersetcontent

* format a comment

* move some variant matches

* inventory.rs

* inventory stuff

* more inventory stuff

* inventory/container tracking works

* start adding interact function

* sequence number

* start adding HitResultComponent

* implement traverse_blocks

* start adding clip

* add clip function

* update_hit_result_component

* start trying to fix

* fix

* make some stuff simpler

* clippy

* lever

* chest

* container handle

* fix ambiguity

* fix some doc tests

* move some container stuff from az-client to azalea

* clicking container

* start implementing simulate_click

* keep working on simulate click

* implement more of simulate_click

this is really boring

* inventory fixes

* start implementing shift clicking

* fix panic in azalea-chat i hope

* shift clicking implemented

* more inventory stuff

* fix items not showing in containers sometimes

* fix test

* fix all warnings

* remove a println

---------

Co-authored-by: mat <git@matdoes.dev>
2023-05-03 20:57:27 -05:00
..
benches Inventory (#48) 2023-05-03 20:57:27 -05:00
src fix tests 2023-04-12 03:26:37 +00:00
tests simd number arrays 2023-03-23 20:20:13 -05:00
Cargo.toml fix conflicts that happen sometimes with serde 2023-05-01 18:36:40 -05:00
README.md nbt lookup optimization 2023-03-23 19:38:18 +00:00

Azalea NBT

A fast NBT serializer and deserializer.

  • Gzip and Zlib compression
  • All data is owned for ease-of-use
  • Serde support with the serde feature.

Examples

use azalea_nbt::{Nbt, NbtCompound};
use std::io::Cursor;

let buf = include_bytes!("../tests/hello_world.nbt");
let tag = Nbt::read(&mut Cursor::new(&buf[..])).unwrap();
assert_eq!(
    tag,
    Nbt::Compound(NbtCompound::from_iter(vec![(
        "hello world".into(),
        Nbt::Compound(NbtCompound::from_iter(vec![(
            "name".into(),
            Nbt::String("Bananrama".into()),
        )]))
    )]))
);

Benchmarks

At the time of writing, Azalea NBT is the fastest NBT decoder (approximately twice as fast as Graphite NBT, the second fastest) and on-par with the fastest NBT encoders (sometimes the fastest, depending on the data).

You can run the benchmarks to compare against other NBT libraries with cargo bench --bench compare and the normal benchmarks with cargo bench --bench nbt.

Note: For best performance, use RUSTFLAGS='-C target-cpu=native'.