diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-03-25 11:17:39 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-25 11:17:39 -0500 |
| commit | ef357fdf3667f3ded03203fc0f7cdec48a01ad8f (patch) | |
| tree | 6e7429c62a22fec1988278f63554c93bdd905a5d /codegen/lib/code/entity.py | |
| parent | 8af265e48bf9f3d5263c074d034770e4216bb3f3 (diff) | |
| download | azalea-drasl-ef357fdf3667f3ded03203fc0f7cdec48a01ad8f.tar.xz | |
1.21.5 (#198)
* 25w02a
* move item_components codegen to a different module
* remove outdated test
* 25w03a
* start updating to 24w09b
* 1.21.5-pre2
* fix broken packets
* 1.21.5-rc2
* merge main
* delete unused acket_handling
* 1.21.5
Diffstat (limited to 'codegen/lib/code/entity.py')
| -rw-r--r-- | codegen/lib/code/entity.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index a1f5525d..c27c4ce7 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -103,23 +103,24 @@ def generate_entity_metadata(burger_entities_data: dict, mappings: Mappings): // This file is generated from codegen/lib/code/entity.py. // Don't change it manually! -use crate::particle::Particle; - -use super::{ - ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, - Rotations, SnifferStateKind, VillagerData, -}; use azalea_chat::FormattedText; use azalea_core::{ direction::Direction, position::{BlockPos, Vec3}, }; use azalea_inventory::ItemStack; +use azalea_registry::DataRegistry; use bevy_ecs::{bundle::Bundle, component::Component}; use derive_more::{Deref, DerefMut}; use thiserror::Error; use uuid::Uuid; +use super::{ + ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, + Rotations, SnifferStateKind, VillagerData, +}; +use crate::particle::Particle; + #[derive(Error, Debug)] pub enum UpdateMetadataError { #[error("Wrong type ({0:?})")] @@ -410,12 +411,15 @@ impl From<EntityDataValue> for UpdateMetadataError { # some types don't have Default implemented if type_name == 'CompoundTag': default = 'simdnbt::owned::NbtCompound::default()' - elif type_name == 'CatVariant': - default = 'azalea_registry::CatVariant::Tabby' - elif type_name == 'PaintingVariant': - default = 'azalea_registry::PaintingVariant::Kebab' - elif type_name == 'FrogVariant': - default = 'azalea_registry::FrogVariant::Temperate' + # elif type_name == 'CatVariant': + # # TODO: the default should be Tabby but we don't have a way to get that from here + # default = 'azalea_registry::CatVariant::new_raw(0)' + # elif type_name == 'PaintingVariant': + # default = 'azalea_registry::PaintingVariant::Kebab' + # elif type_name == 'FrogVariant': + # default = 'azalea_registry::FrogVariant::Temperate' + elif type_name.endswith('Variant'): + default = f'azalea_registry::{type_name}::new_raw(0)' elif type_name == 'VillagerData': default = 'VillagerData { kind: azalea_registry::VillagerKind::Plains, profession: azalea_registry::VillagerProfession::None, level: 0 }' else: @@ -430,7 +434,7 @@ impl From<EntityDataValue> for UpdateMetadataError { default = f'BlockPos::new{default}' elif type_name == 'OptionalBlockPos': # Option<BlockPos> default = f'Some(BlockPos::new{default})' if default != 'Empty' else 'None' - elif type_name == 'OptionalUuid': + elif type_name == 'OptionalLivingEntityReference': default = f'Some(uuid::uuid!({default}))' if default != 'Empty' else 'None' elif type_name == 'OptionalUnsignedInt': default = f'OptionalUnsignedInt(Some({default}))' if default != 'Empty' else 'OptionalUnsignedInt(None)' |
