diff --git a/azalea-entity/src/data.rs b/azalea-entity/src/data.rs index 076b8f29d..67476d8bb 100755 --- a/azalea-entity/src/data.rs +++ b/azalea-entity/src/data.rs @@ -86,7 +86,7 @@ pub enum EntityDataValue { FrogVariant(azalea_registry::FrogVariant), OptionalGlobalPos(Option), PaintingVariant(azalea_registry::PaintingVariant), - SnifferState(SnifferState), + SnifferState(SnifferStateKind), ArmadilloState(ArmadilloStateKind), Vector3(Vec3), Quaternion(Quaternion), @@ -162,7 +162,7 @@ pub struct VillagerData { } #[derive(Debug, Copy, Clone, AzBuf, Default)] -pub enum SnifferState { +pub enum SnifferStateKind { #[default] Idling, FeelingHappy, diff --git a/azalea-entity/src/metadata.rs b/azalea-entity/src/metadata.rs index 1a68c983c..41e7a0e85 100644 --- a/azalea-entity/src/metadata.rs +++ b/azalea-entity/src/metadata.rs @@ -16,7 +16,7 @@ use uuid::Uuid; use super::{ ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, - Rotations, SnifferState, VillagerData, + Rotations, SnifferStateKind, VillagerData, }; use crate::particle::Particle; @@ -8100,7 +8100,7 @@ impl Default for SmallFireballMetadataBundle { } #[derive(Component, Deref, DerefMut, Clone)] -pub struct State(pub SnifferState); +pub struct SnifferState(pub SnifferStateKind); #[derive(Component, Deref, DerefMut, Clone)] pub struct DropSeedAtTick(pub i32); #[derive(Component)] @@ -8113,7 +8113,7 @@ impl Sniffer { match d.index { 0..=16 => AbstractAnimal::apply_metadata(entity, d)?, 17 => { - entity.insert(State(d.value.into_sniffer_state()?)); + entity.insert(SnifferState(d.value.into_sniffer_state()?)); } 18 => { entity.insert(DropSeedAtTick(d.value.into_int()?)); @@ -8128,7 +8128,7 @@ impl Sniffer { pub struct SnifferMetadataBundle { _marker: Sniffer, parent: AbstractAnimalMetadataBundle, - state: State, + sniffer_state: SnifferState, drop_seed_at_tick: DropSeedAtTick, } impl Default for SnifferMetadataBundle { @@ -8179,7 +8179,7 @@ impl Default for SnifferMetadataBundle { abstract_ageable_baby: AbstractAgeableBaby(false), }, }, - state: State(Default::default()), + sniffer_state: SnifferState(Default::default()), drop_seed_at_tick: DropSeedAtTick(0), } } diff --git a/codegen/lib/code/entity.py b/codegen/lib/code/entity.py index a380d3d9a..1d15bd0b8 100644 --- a/codegen/lib/code/entity.py +++ b/codegen/lib/code/entity.py @@ -104,7 +104,7 @@ def generate_entity_metadata(burger_entities_data: dict, mappings: Mappings): use super::{ ArmadilloStateKind, EntityDataItem, EntityDataValue, OptionalUnsignedInt, Pose, Quaternion, - Rotations, SnifferState, VillagerData, + Rotations, SnifferStateKind, VillagerData, }; use azalea_chat::FormattedText; use azalea_core::{ @@ -140,6 +140,10 @@ def generate_entity_metadata(burger_entities_data: dict, mappings: Mappings): # build the duplicate_field_names set previous_field_names = set() duplicate_field_names = set() + + # some generic names... we don't like these + duplicate_field_names.add('state') # SnifferState instead of State + for entity_id in burger_entity_metadata.keys(): field_name_map[entity_id] = {} for field_name_or_bitfield in get_entity_metadata_names(entity_id, burger_entity_metadata, mappings).values():