diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-09-30 10:56:34 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-30 10:56:34 -0500 |
| commit | 643fcb98c0e6cdc63218dd39960d9053b209d9a6 (patch) | |
| tree | 6bddb7fe39b8fcc3ab3fb2665574533bb227898a /codegen/lib/code/data_components.py | |
| parent | a80d8d1b242430c4a251876fa67bfd26af7a0de9 (diff) | |
| download | azalea-drasl-643fcb98c0e6cdc63218dd39960d9053b209d9a6.tar.xz | |
1.21.9 (#235)
* start updating to 25w33a
* 1.21.9-pre2
* clippy
* cleanup, and fix c_explode and c_player_rotation
* mc update should be in Changed section in the changelog
* 1.21.9
Diffstat (limited to 'codegen/lib/code/data_components.py')
| -rw-r--r-- | codegen/lib/code/data_components.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/codegen/lib/code/data_components.py b/codegen/lib/code/data_components.py index d29096d2..bba952e1 100644 --- a/codegen/lib/code/data_components.py +++ b/codegen/lib/code/data_components.py @@ -315,6 +315,18 @@ use crate::{ list(python_value.values())[0], target_rust_type ) return str(python_value) + elif target_rust_type == "NbtCompound": + # NbtCompound::from_values([ + # ("id".into(), "minecraft:allay".into()), + # ]), + t = "NbtCompound::from_values(vec![" + for k, v in python_value.items(): + if isinstance(v, str): + t += f'("{k}".into(), "{v}".into()),' + else: + t += f'("{k}".into(), {python_to_rust_value(v, "FIXME_UNKNOWN_NBT")}),' + t = t.rstrip(",") + "])" + return t if isinstance(python_value, dict): if target_rust_type == "ResourceLocation" and len(python_value) == 1: |
