diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2025-12-09 11:23:45 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-09 11:23:45 -0600 |
| commit | 84cd261118c9d1e3145d4d1751c0d22098cd8cd8 (patch) | |
| tree | f9beeb5697a4b895423ef24989044fca8afc5594 /azalea-inventory/src/components | |
| parent | 676707aab320339b4c7406ee4f494b530f44e926 (diff) | |
| download | azalea-drasl-84cd261118c9d1e3145d4d1751c0d22098cd8cd8.tar.xz | |
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
Diffstat (limited to 'azalea-inventory/src/components')
| -rw-r--r-- | azalea-inventory/src/components/mod.rs | 193 |
1 files changed, 192 insertions, 1 deletions
diff --git a/azalea-inventory/src/components/mod.rs b/azalea-inventory/src/components/mod.rs index 34d0a9b4..9c27db8c 100644 --- a/azalea-inventory/src/components/mod.rs +++ b/azalea-inventory/src/components/mod.rs @@ -16,7 +16,7 @@ use azalea_core::{ filterable::Filterable, identifier::Identifier, position::GlobalPos, - registry_holder::RegistryHolder, + registry_holder::{DamageTypeElement, RegistryHolder}, sound::CustomSound, }; use azalea_registry::{ @@ -285,6 +285,14 @@ define_data_components!( CatCollar, SheepColor, ShulkerColor, + UseEffects, + MinimumAttackCharge, + DamageType, + PiercingWeapon, + KineticWeapon, + SwingAnimation, + ZombieNautilusVariant, + AttackRange, ); #[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] @@ -1465,3 +1473,186 @@ pub enum ChickenVariant { pub struct ChickenVariantData { pub registry: azalea_registry::ChickenVariant, } + +// TODO: check in-game if this is correct +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub enum ZombieNautilusVariant { + Referenced(Identifier), + Direct(ZombieNautilusVariantData), +} +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +#[serde(transparent)] +pub struct ZombieNautilusVariantData { + pub value: azalea_registry::ZombieNautilusVariant, +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub struct UseEffects { + pub can_sprint: bool, + pub interact_vibrations: bool, + pub speed_multiplier: f32, +} +impl UseEffects { + pub const fn new() -> Self { + Self { + can_sprint: false, + interact_vibrations: true, + speed_multiplier: 0.2, + } + } +} +impl Default for UseEffects { + fn default() -> Self { + Self::new() + } +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +#[serde(transparent)] +pub struct MinimumAttackCharge { + pub value: f32, +} + +// TODO: this is probably wrong, check in-game +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +#[serde(untagged)] +pub enum DamageType { + Registry(registry::DamageKind), + Holder(Holder<registry::DamageKind, DamageTypeElement>), +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub struct PiercingWeapon { + pub deals_knockback: bool, + pub dismounts: bool, + pub sound: Option<Holder<SoundEvent, azalea_core::sound::CustomSound>>, + pub hit_sound: Option<Holder<SoundEvent, azalea_core::sound::CustomSound>>, +} +impl PiercingWeapon { + pub const fn new() -> Self { + Self { + deals_knockback: true, + dismounts: false, + sound: None, + hit_sound: None, + } + } +} +impl Default for PiercingWeapon { + fn default() -> Self { + Self::new() + } +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub struct KineticWeapon { + #[var] + pub contact_cooldown_ticks: i32, + #[var] + pub delay_ticks: i32, + pub dismount_conditions: Option<KineticWeaponCondition>, + pub knockback_conditions: Option<KineticWeaponCondition>, + pub damage_conditions: Option<KineticWeaponCondition>, + pub forward_movement: f32, + pub damage_multiplier: f32, + pub sound: Option<Holder<SoundEvent, azalea_core::sound::CustomSound>>, + pub hit_sound: Option<Holder<SoundEvent, azalea_core::sound::CustomSound>>, +} +impl KineticWeapon { + pub const fn new() -> Self { + Self { + contact_cooldown_ticks: 10, + delay_ticks: 0, + dismount_conditions: None, + knockback_conditions: None, + damage_conditions: None, + forward_movement: 0., + damage_multiplier: 1., + sound: None, + hit_sound: None, + } + } +} +impl Default for KineticWeapon { + fn default() -> Self { + Self::new() + } +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub struct KineticWeaponCondition { + #[var] + pub max_duration_ticks: i32, + pub min_speed: f32, + pub min_relative_speed: f32, +} +impl KineticWeaponCondition { + pub const fn new() -> Self { + Self { + max_duration_ticks: 0, + min_speed: 0., + min_relative_speed: 0., + } + } +} +impl Default for KineticWeaponCondition { + fn default() -> Self { + Self::new() + } +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub struct SwingAnimation { + #[serde(rename = "type")] + pub kind: SwingAnimationKind, + #[var] + pub duration: i32, +} +impl SwingAnimation { + pub const fn new() -> Self { + Self { + kind: SwingAnimationKind::Whack, + duration: 6, + } + } +} +impl Default for SwingAnimation { + fn default() -> Self { + Self::new() + } +} + +#[derive(Clone, Copy, PartialEq, AzBuf, Debug, Serialize)] +#[serde(rename_all = "snake_case")] +pub enum SwingAnimationKind { + None, + Whack, + Stab, +} + +#[derive(Clone, PartialEq, AzBuf, Debug, Serialize)] +pub struct AttackRange { + pub min_reach: f32, + pub max_reach: f32, + pub min_creative_reach: f32, + pub max_creative_reach: f32, + pub hitbox_margin: f32, + pub mob_factor: f32, +} +impl AttackRange { + pub const fn new() -> Self { + Self { + min_reach: 0., + max_reach: 3., + min_creative_reach: 0., + max_creative_reach: 5., + hitbox_margin: 0.3, + mob_factor: 1., + } + } +} +impl Default for AttackRange { + fn default() -> Self { + Self::new() + } +} |
