Skip to content

Commit

Permalink
rename metadata::State to metadata::SnifferState
Browse files Browse the repository at this point in the history
  • Loading branch information
mat-1 committed Dec 23, 2024
1 parent fa132b6 commit 1609b90
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions azalea-entity/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub enum EntityDataValue {
FrogVariant(azalea_registry::FrogVariant),
OptionalGlobalPos(Option<GlobalPos>),
PaintingVariant(azalea_registry::PaintingVariant),
SnifferState(SnifferState),
SnifferState(SnifferStateKind),
ArmadilloState(ArmadilloStateKind),
Vector3(Vec3),
Quaternion(Quaternion),
Expand Down Expand Up @@ -162,7 +162,7 @@ pub struct VillagerData {
}

#[derive(Debug, Copy, Clone, AzBuf, Default)]
pub enum SnifferState {
pub enum SnifferStateKind {
#[default]
Idling,
FeelingHappy,
Expand Down
10 changes: 5 additions & 5 deletions azalea-entity/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)]
Expand All @@ -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()?));
Expand All @@ -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 {
Expand Down Expand Up @@ -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),
}
}
Expand Down
6 changes: 5 additions & 1 deletion codegen/lib/code/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 1609b90

Please sign in to comment.