From 84cd261118c9d1e3145d4d1751c0d22098cd8cd8 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:23:45 -0600 Subject: 1.21.11 (#273) * run codegen for 25w44a * 25w44a * 25w46a * rename ResourceLocation to Identifier per mojmap changes * update changelog * 1.21.11-pre1 * 1.21.11-pre2 * 1.21.11-pre3 * add AttackRange fields from pre4 * 1.21.11-rc3 * 1.21.11 --- codegen/lib/code/data_components.py | 14 ++++++++++++-- codegen/lib/code/entity.py | 2 +- codegen/lib/download.py | 5 ++++- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'codegen/lib') diff --git a/codegen/lib/code/data_components.py b/codegen/lib/code/data_components.py index 57e30172..b7e94c28 100644 --- a/codegen/lib/code/data_components.py +++ b/codegen/lib/code/data_components.py @@ -180,7 +180,9 @@ def update_default_variants(version_id: str): use std::collections::HashMap; use azalea_chat::translatable_component::TranslatableComponent; -use azalea_registry::{Attribute, Block, EntityKind, HolderSet, Item, MobEffect, SoundEvent}; +use azalea_registry::{ + Attribute, Block, DataRegistry, EntityKind, HolderSet, Item, MobEffect, SoundEvent, +}; use simdnbt::owned::NbtCompound; use crate::{ @@ -383,6 +385,10 @@ use crate::{ # create a struct based on the defaults t = f"{target_rust_type} {{" for k, v in python_value.items(): + if k == 'type': + # azalea's convention is to use "kind" instead of "type" + k = 'kind' + # get the type of the fields inner_type = enum_and_struct_fields.get(target_rust_type, {}).get( k, "FIXME_UNKNOWN_TYPE" @@ -411,13 +417,17 @@ use crate::{ [python_value], f"Vec<{holderset_type}>" ) return f"HolderSet::Direct {{ contents: {main_vec} }}" - elif target_rust_type.startswith("azalea_registry::Holder<"): + elif target_rust_type.startswith("azalea_registry::Holder<") or target_rust_type.startswith("Holder<"): 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 == "Identifier": # convert minecraft:air into Identifier::from_static("minecraft:air") return f'"{python_value}".into()' + elif target_rust_type == 'DamageType': + # TODO: this is intentionally incorrect, see the comment in + # azalea-registry/src/data.rs to see how to fix this properly + return 'DamageType::Registry(azalea_registry::DamageKind::new_raw(0))' else: # enum variant return f"{target_rust_type}::{lib.utils.to_camel_case(python_value.split(':')[-1])}" diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index 18a7a04b..e9da0404 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -124,7 +124,7 @@ use super::{ ArmadilloStateKind, CopperGolemStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, Rotations, SnifferStateKind, VillagerData, WeatheringCopperStateKind, }; -use crate::particle::Particle; +use crate::{HumanoidArm, particle::Particle}; #[derive(Error, Debug)] pub enum UpdateMetadataError { diff --git a/codegen/lib/download.py b/codegen/lib/download.py index de6e2f2d..fa963188 100644 --- a/codegen/lib/download.py +++ b/codegen/lib/download.py @@ -137,7 +137,10 @@ def get_latest_fabric_api_version(): maven_metadata_xml = json.load(f) tree = ET.ElementTree(ET.fromstring(maven_metadata_xml)) - return tree.find(".//latest").text + name = tree.find(".//latest").text + if name.endswith('_unobfuscated'): + name = name[:-len('_unobfuscated')] + return name def get_latest_fabric_kotlin_version(): -- cgit v1.2.3