1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 06:16:04 +00:00

make metadata components clonable

This commit is contained in:
mat 2023-02-21 21:46:30 -06:00
parent 6942e3547b
commit 66094921c8
3 changed files with 273 additions and 273 deletions

File diff suppressed because it is too large Load diff

View file

@ -162,14 +162,14 @@ impl From<EntityDataValue> for UpdateMetadataError {
metadata_type_data = metadata_types[type_id]
rust_type = metadata_type_data['type']
code.append(f'#[derive(Component, Deref, DerefMut)]')
code.append(f'#[derive(Component, Deref, DerefMut, Clone)]')
code.append(f'pub struct {struct_name}(pub {rust_type});')
else:
# if it's a bitfield just make a struct for each bit
for mask, name in name_or_bitfield.items():
name = maybe_rename_field(name, index)
struct_name = upper_first_letter(to_camel_case(name))
code.append(f'#[derive(Component, Deref, DerefMut)]')
code.append(f'#[derive(Component, Deref, DerefMut, Clone, Copy)]')
code.append(f'pub struct {struct_name}(pub bool);')
# add the entity struct and Bundle struct

View file

@ -54,7 +54,7 @@ def determine_python_command():
def try_python_command(version):
return os.system(f'{version} --version') == 0
for version in ('python3.9', 'python3.8', 'python3', 'python'):
for version in (sys.executable, 'python3.9', 'python3.8', 'python3', 'python'):
if try_python_command(version):
python_command = version
return version