From 1cf6d92f1a8be954f6885704c31f317b99b05972 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 7 Oct 2025 06:01:19 +0400 Subject: update ResolvableProfile data component to 1.21.9 --- codegen/lib/code/data_components.py | 8 ++++---- codegen/lib/code/entity.py | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'codegen') diff --git a/codegen/lib/code/data_components.py b/codegen/lib/code/data_components.py index b1444860..89796a91 100644 --- a/codegen/lib/code/data_components.py +++ b/codegen/lib/code/data_components.py @@ -4,7 +4,7 @@ import lib.extract import lib.utils -DATA_COMPONENTS_DIR = "azalea-inventory/src/components.rs" +DATA_COMPONENTS_DIR = "azalea-inventory/src/components/mod.rs" DEFAULT_DATA_COMPONENTS_DIR = "azalea-inventory/src/default_components/generated.rs" @@ -322,7 +322,7 @@ use crate::{ entity_id = python_value["id"] elif isinstance(python_value, str): entity_id = python_value - + if entity_id and entity_id.startswith("minecraft:"): entity_name = entity_id[10:] # Remove "minecraft:" prefix entity_name_camel = lib.utils.to_camel_case(entity_name) @@ -512,7 +512,7 @@ use crate::{ # Special handling for EntityData to use EntityData structure # Keep rust_value as "value" so it gets processed correctly field_type = "EntityKind" - + def transform_value_fn(rust_value: str): return f"{component_struct_name} {{ kind: {rust_value}, data: NbtCompound::new() }}" @@ -623,7 +623,7 @@ use crate::{ def get_enum_and_struct_fields(): """ Returns a map like map like `{ "MaxStackSize": { "count": i32 }, "Rarity": [ "common", ... ], ... }` - with an entry for each struct in components.rs. + with an entry for each struct in components/mod.rs. """ with open(DATA_COMPONENTS_DIR, "r") as f: diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index 1c2a0d48..18a7a04b 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -113,7 +113,7 @@ use azalea_core::{ direction::Direction, position::{BlockPos, Vec3f32}, }; -use azalea_inventory::ItemStack; +use azalea_inventory::{ItemStack, components}; use azalea_registry::DataRegistry; use bevy_ecs::{bundle::Bundle, component::Component}; use derive_more::{Deref, DerefMut}; @@ -122,8 +122,7 @@ use uuid::Uuid; use super::{ ArmadilloStateKind, CopperGolemStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, - Pose, Quaternion, ResolvableProfile, Rotations, SnifferStateKind, VillagerData, - WeatheringCopperStateKind, + Pose, Quaternion, Rotations, SnifferStateKind, VillagerData, WeatheringCopperStateKind, }; use crate::particle::Particle; -- cgit v1.2.3