Skip to content

Commit 43479e7

Browse files
committed
Merge branch 'undead-variants' into tamable-mobs
2 parents 1a77533 + d24c0cb commit 43479e7

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

pomme-client/src/entity/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ pub struct LivingEntity {
7676
pub wool_color: Option<u8>,
7777
/// Sheep wool shorn / bogged mushrooms shorn.
7878
pub is_sheared: bool,
79-
/// Registry/wire variant slot; meaning is per-kind (pool index for
80-
/// cow/chicken). Normalized in `EntityStore::set_variant`.
79+
/// Registry/wire variant slot; meaning is per-kind. Holder-backed values
80+
/// are pre-resolved to pool indices by the net handler; raw-int kinds are
81+
/// normalized in `EntityStore::apply_entity_data`.
8182
pub variant: u32,
8283
/// Chicken wing-flap state (vanilla `Chicken.aiStep`): `flap` is the
8384
/// unbounded wing-cycle phase, `flap_speed` the 0..1 amplitude.
@@ -796,10 +797,8 @@ impl EntityStore {
796797
(EntityKind::Enderman, 17, Bool(b)) => entity.is_creepy = b,
797798
(EntityKind::Witch, 17, Bool(b)) => entity.witch_drinking = b,
798799
// Zombie-family underwater conversion / zombie villager curing.
799-
(EntityKind::Zombie | EntityKind::Husk | EntityKind::Drowned, 18, Bool(b)) => {
800-
entity.is_converting = b
801-
}
802-
(EntityKind::ZombieVillager, 19, Bool(b)) => entity.is_converting = b,
800+
(EntityKind::Zombie | EntityKind::Husk | EntityKind::Drowned, 18, Bool(b))
801+
| (EntityKind::ZombieVillager, 19, Bool(b)) => entity.is_converting = b,
803802
(EntityKind::Villager, 18, Int(c)) => entity.unhappy_counter = c,
804803
// Vanilla sparse rabbit id map: 99 = evil, unknown ids fall back
805804
// to brown.

pomme-client/src/net/handler.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,24 +497,22 @@ pub fn handle_game_packet(
497497
if item.index == 18
498498
&& let azalea_entity::EntityDataValue::CowVariant(variant) = &item.value
499499
{
500-
use azalea_registry::DataRegistry;
501500
let _ = event_tx.try_send(variant_event(
502501
registry_holder,
503502
p.id.0,
504503
EntityKind::Cow,
505-
variant.protocol_id(),
504+
variant,
506505
));
507506
}
508507
// Index 18 on chickens = ChickenVariant Holder.
509508
if item.index == 18
510509
&& let azalea_entity::EntityDataValue::ChickenVariant(variant) = &item.value
511510
{
512-
use azalea_registry::DataRegistry;
513511
let _ = event_tx.try_send(variant_event(
514512
registry_holder,
515513
p.id.0,
516514
EntityKind::Chicken,
517-
variant.protocol_id(),
515+
variant,
518516
));
519517
}
520518
// Index 20 on cats = CatVariant Holder.
@@ -780,12 +778,12 @@ fn variant_event(
780778
registry_holder: &RegistryHolder,
781779
id: i32,
782780
kind: EntityKind,
783-
protocol_id: u32,
781+
holder: &impl azalea_registry::DataRegistry,
784782
) -> NetworkEvent {
785783
NetworkEvent::EntityVariant {
786784
id,
787785
kind,
788-
variant: variant_index(registry_holder, kind, protocol_id),
786+
variant: variant_index(registry_holder, kind, holder.protocol_id()),
789787
}
790788
}
791789

pomme-client/src/net/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,8 @@ pub enum NetworkEvent {
307307
FinishUseItem {
308308
id: i32,
309309
},
310-
/// Registry/wire variant slot; meaning is per-kind (pool index for
311-
/// cow/chicken). Per-kind normalization lives in
312-
/// `EntityStore::set_variant`; `kind` is the mob the emitting arm
313-
/// resolved for, guarding overloaded metadata indices.
310+
/// Registry/wire variant slot; meaning is per-kind. `kind` is the mob
311+
/// the emitting arm resolved for, guarding overloaded metadata indices.
314312
EntityVariant {
315313
id: i32,
316314
kind: EntityKind,

0 commit comments

Comments
 (0)