diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2024-04-23 10:34:50 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-23 10:34:50 -0500 |
| commit | 1d80f531b74bc3b31023753acb81b35efcdadd73 (patch) | |
| tree | 675635c7c41fbb456e3e0dd7b9f09c7211d356f0 /codegen/lib/code/entity.py | |
| parent | 0ddad8bd9c7c0e8846aec8bc90c95416418c9a63 (diff) | |
| download | azalea-drasl-1d80f531b74bc3b31023753acb81b35efcdadd73.tar.xz | |
1.20.5 (#127)
* 23w51b
* make recalculate_near_end_of_path public
so other plugins can do .after(recalculate_near_end_of_path)
* update to 24w03a i think
* start implementing 24w13a
* registries work (but a lot of packets are still broken)
* fix recipes and commands packets
* i love codecs :D i am not going insane :D mojang's java is very readable :D
* item components are "implemented" meowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeowmeow
* update to 1.20.5-pre3
* fix all the broken packets and clippy (mojang please don't do an update like this again or i will murder someone)
* 1.20.5-rc1
* fix failing tests
* 1.20.5
Diffstat (limited to 'codegen/lib/code/entity.py')
| -rw-r--r-- | codegen/lib/code/entity.py | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index 8fa11430..5f0bc3d9 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -89,7 +89,7 @@ def generate_entity_metadata(burger_entities_data: dict, mappings: Mappings): with open(DATA_RS_DIR, 'w') as f: f.write('\n'.join(lines)) print('Expected metadata types:\n' + '\n'.join(new_metadata_names)) - print('Updated metadata types in azalea-world/src/entity/data.rs, go make sure they\'re correct and then press enter') + print('Updated metadata types in azalea-entity/src/data.rs, go make sure they\'re correct (check EntityDataSerializers.java) and then press enter') input() metadata_types = parse_metadata_types_from_code() @@ -100,12 +100,17 @@ 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::{ - EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, Rotations, - SnifferState, VillagerData + ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, + Rotations, SnifferState, VillagerData, }; use azalea_chat::FormattedText; -use azalea_core::{particle::Particle, position::{BlockPos, Vec3}, direction::Direction}; +use azalea_core::{ + direction::Direction, + position::{BlockPos, Vec3}, +}; use azalea_inventory::ItemSlot; use bevy_ecs::{bundle::Bundle, component::Component}; use derive_more::{Deref, DerefMut}; @@ -218,8 +223,7 @@ impl From<EntityDataValue> for UpdateMetadataError { struct_name = upper_first_letter( to_camel_case(name_or_bitfield)) - type_id = next(filter(lambda i: i['index'] == index, entity_metadatas))[ - 'type_id'] + type_id = next(filter(lambda i: i['index'] == index, entity_metadatas))['type_id'] metadata_type_data = metadata_types[type_id] rust_type = metadata_type_data['type'] @@ -281,8 +285,7 @@ impl From<EntityDataValue> for UpdateMetadataError { if name_or_bitfield in single_use_imported_types: field_struct_name = '' - type_id = next(filter(lambda i: i['index'] == index, entity_metadatas))[ - 'type_id'] + type_id = next(filter(lambda i: i['index'] == index, entity_metadatas))['type_id'] metadata_type_data = metadata_types[type_id] rust_type = metadata_type_data['type'] type_name = metadata_type_data['name'] @@ -384,8 +387,7 @@ impl From<EntityDataValue> for UpdateMetadataError { ' },') for index, name_or_bitfield in get_entity_metadata_names(this_entity_id, burger_entity_metadata, mappings).items(): - default = next(filter(lambda i: i['index'] == index, entity_metadatas)).get( - 'default', 'Default::default()') + default = next(filter(lambda i: i['index'] == index, entity_metadatas)).get('default', 'Default::default()') if isinstance(name_or_bitfield, str): type_id = next(filter(lambda i: i['index'] == index, entity_metadatas))[ 'type_id'] @@ -454,8 +456,10 @@ impl From<EntityDataValue> for UpdateMetadataError { for mask, name in name_or_bitfield.items(): name = maybe_rename_field(name, index) mask = int(mask, 0) - bit_default = 'true' if ( - default & mask != 0) else 'false' + if default is None: + bit_default = 'false' + else: + bit_default = 'true' if (default & mask != 0) else 'false' code.append( f' {name}: {upper_first_letter(to_camel_case(name))}({bit_default}),') code.append(' Self {') |
