diff --git a/README.md b/README.md index e907e4c01..813607ff7 100644 --- a/README.md +++ b/README.md @@ -112,4 +112,4 @@ Consider joining [our Discord server](https://discord.gg/pumpkinmc) to stay up-t ## Funding -If you want to fund me and help the project, check out my [GitHub sponsors](https://github.com/sponsors/Snowiiii). +If you want to fund me and help the project, check out my [GitHub sponsors](https://github.com/sponsors/Pumpkin-MC). diff --git a/pumpkin-codegen/src/damage_type.rs b/pumpkin-codegen/src/damage_type.rs index ebac1e37c..12a2970ef 100644 --- a/pumpkin-codegen/src/damage_type.rs +++ b/pumpkin-codegen/src/damage_type.rs @@ -113,6 +113,8 @@ pub fn build() -> TokenStream { } quote! { + use crate::tag::{RegistryKey, Tag, Taggable}; + #[derive(Clone, Copy, Debug, PartialEq)] pub struct DamageType { pub death_message_type: DeathMessageType, @@ -159,5 +161,20 @@ pub fn build() -> TokenStream { } } + + impl Taggable for DamageType { + #[inline] + fn tag_key() -> RegistryKey { + RegistryKey::DamageType + } + #[inline] + fn registry_key(&self) -> &str { + self.message_id + } + #[inline] + fn registry_id(&self) -> u16 { + self.id as u16 + } + } } } diff --git a/pumpkin-data/src/generated/damage_type.rs b/pumpkin-data/src/generated/damage_type.rs index bc1568eca..f472c37d5 100644 --- a/pumpkin-data/src/generated/damage_type.rs +++ b/pumpkin-data/src/generated/damage_type.rs @@ -1,4 +1,5 @@ /* This file is generated. Do not edit manually. */ +use crate::tag::{RegistryKey, Tag, Taggable}; #[derive(Clone, Copy, Debug, PartialEq)] pub struct DamageType { pub death_message_type: DeathMessageType, @@ -487,3 +488,17 @@ impl DamageType { } } } +impl Taggable for DamageType { + #[inline] + fn tag_key() -> RegistryKey { + RegistryKey::DamageType + } + #[inline] + fn registry_key(&self) -> &str { + self.message_id + } + #[inline] + fn registry_id(&self) -> u16 { + self.id as u16 + } +} diff --git a/pumpkin/src/command/commands/pumpkin.rs b/pumpkin/src/command/commands/pumpkin.rs index 4b5e22fd7..acfadff0d 100644 --- a/pumpkin/src/command/commands/pumpkin.rs +++ b/pumpkin/src/command/commands/pumpkin.rs @@ -203,7 +203,7 @@ impl CommandExecutor for Executor { .add_child( TextComponent::text("[Donate]") .click_event(ClickEvent::OpenUrl { - url: Cow::from("https://github.com/sponsors/Snowiiii"), + url: Cow::from("https://github.com/sponsors/Pumpkin-MC"), }) .hover_event(HoverEvent::show_text(TextComponent::text( "Click to open Donate", diff --git a/pumpkin/src/entity/decoration/end_crystal.rs b/pumpkin/src/entity/decoration/end_crystal.rs index 18702e186..3633ff045 100644 --- a/pumpkin/src/entity/decoration/end_crystal.rs +++ b/pumpkin/src/entity/decoration/end_crystal.rs @@ -1,7 +1,12 @@ use core::f32; use crate::entity::{Entity, EntityBase, EntityBaseFuture, NBTStorage, living::LivingEntity}; -use pumpkin_data::{damage::DamageType, meta_data_type::MetaDataType, tracked_data::TrackedData}; +use pumpkin_data::{ + damage::DamageType, + meta_data_type::MetaDataType, + tag::{self, Taggable}, + tracked_data::TrackedData, +}; use pumpkin_protocol::java::client::play::Metadata; use pumpkin_util::math::vector3::Vector3; @@ -48,7 +53,8 @@ impl EntityBase for EndCrystalEntity { _cause: Option<&'a dyn EntityBase>, ) -> EntityBaseFuture<'a, bool> { Box::pin(async move { - if damage_type != DamageType::EXPLOSION { + self.entity.remove().await; + if !damage_type.has_tag(&tag::DamageType::MINECRAFT_IS_EXPLOSION) { self.entity .world .load() @@ -57,7 +63,6 @@ impl EntityBase for EndCrystalEntity { } // TODO - self.entity.remove().await; true }) } diff --git a/pumpkin/src/entity/projectile/arrow.rs b/pumpkin/src/entity/projectile/arrow.rs index 907c84038..0045caad6 100644 --- a/pumpkin/src/entity/projectile/arrow.rs +++ b/pumpkin/src/entity/projectile/arrow.rs @@ -390,12 +390,12 @@ impl EntityBase for ArrowEntity { let bonus = (rand::random::() % (damage / 2 + 2) as u32) as i32; damage = damage.saturating_add(bonus); } + target + .damage(&*target, damage as f32, DamageType::ARROW) + .await; - if let Some(living) = target.get_living_entity() { - // Apply damage to target - living - .damage(living, damage as f32, DamageType::ARROW) - .await; + if target.get_living_entity().is_some() { + // TODO: knockback // Play hit sound let sound_packet = CSoundEffect::new(