diff options
| author | mat <git@matdoes.dev> | 2025-11-13 12:34:47 +0930 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-11-13 07:04:52 +0400 |
| commit | fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00 (patch) | |
| tree | 3126fb34a4e0ac979a1103a8227a2b9a136c1553 /codegen/lib/code/data_components.py | |
| parent | a4312599f7c04709a92b7be238dcf577bafbb14f (diff) | |
| download | azalea-drasl-fbaae39cdf9c5a7a34005a51a37b85f7cdd5ea00.tar.xz | |
rename ResourceLocation to Identifier ahead of mojmap changes
Diffstat (limited to 'codegen/lib/code/data_components.py')
| -rw-r--r-- | codegen/lib/code/data_components.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/codegen/lib/code/data_components.py b/codegen/lib/code/data_components.py index 89796a91..57e30172 100644 --- a/codegen/lib/code/data_components.py +++ b/codegen/lib/code/data_components.py @@ -220,7 +220,7 @@ use crate::{ "probability": "f32", } enum_and_struct_fields["ConsumeEffect::RemoveEffects"] = { - "effects": "HolderSet<MobEffect, ResourceLocation>", + "effects": "HolderSet<MobEffect, Identifier>", } enum_and_struct_fields["ConsumeEffect::ClearAllEffects"] = {} enum_and_struct_fields["ConsumeEffect::TeleportRandomly"] = { @@ -342,7 +342,7 @@ use crate::{ return t if isinstance(python_value, dict): - if target_rust_type == "ResourceLocation" and len(python_value) == 1: + if target_rust_type == "Identifier" and len(python_value) == 1: return python_to_rust_value( list(python_value.values())[0], target_rust_type ) @@ -401,8 +401,8 @@ use crate::{ return str(python_value).lower() if isinstance(python_value, str): fields_for_rust_type = enum_and_struct_fields.get(target_rust_type, []) - if "Referenced(ResourceLocation)" in fields_for_rust_type: - return f"{target_rust_type}::Referenced({python_to_rust_value(python_value, 'ResourceLocation')})" + if "Referenced(Identifier)" in fields_for_rust_type: + return f"{target_rust_type}::Referenced({python_to_rust_value(python_value, 'Identifier')})" elif "Registry(registry::Instrument)" in fields_for_rust_type: return f"{target_rust_type}::Registry({python_to_rust_value(python_value, 'azalea_registry::Instrument')})" elif target_rust_type.startswith("HolderSet<"): @@ -415,8 +415,8 @@ use crate::{ holder_type = target_rust_type.split("<", 1)[1].split(",", 1)[0] inner_type = python_to_rust_value(python_value, holder_type) return f"azalea_registry::Holder::Reference({inner_type})" - elif target_rust_type == "ResourceLocation": - # convert minecraft:air into ResourceLocation::from_static("minecraft:air") + elif target_rust_type == "Identifier": + # convert minecraft:air into Identifier::from_static("minecraft:air") return f'"{python_value}".into()' else: # enum variant |
