diff --git a/pumpkin-data/src/data_component_impl.rs b/pumpkin-data/src/data_component_impl.rs index caff2d906..6f96bf8f4 100644 --- a/pumpkin-data/src/data_component_impl.rs +++ b/pumpkin-data/src/data_component_impl.rs @@ -43,7 +43,7 @@ pub fn read_data(id: DataComponent, data: &NbtTag) -> Option Some(MaxStackSizeImpl::read_data(data)?.to_dyn()), Enchantments => Some(EnchantmentsImpl::read_data(data)?.to_dyn()), Damage => Some(DamageImpl::read_data(data)?.to_dyn()), - _ => todo!(), + _ => None, } } // Also Pumpkin\pumpkin-protocol\src\codec\data_component.rs diff --git a/pumpkin/src/entity/living.rs b/pumpkin/src/entity/living.rs index c8d2c679f..566a67f19 100644 --- a/pumpkin/src/entity/living.rs +++ b/pumpkin/src/entity/living.rs @@ -96,11 +96,12 @@ impl LivingEntity { // TODO: Extract default MOVEMENT_SPEED Entity Attribute let default_movement_speed = 0.25; + let health = entity.entity_type.max_health.unwrap_or(20.0); Self { entity, hurt_cooldown: AtomicI32::new(0), last_damage_taken: AtomicCell::new(0.0), - health: AtomicCell::new(20.0), + health: AtomicCell::new(health), fall_distance: AtomicCell::new(0.0), death_time: AtomicU8::new(0), dead: AtomicBool::new(false), diff --git a/pumpkin/src/entity/type.rs b/pumpkin/src/entity/type.rs index c8c73dd0a..7f2158295 100644 --- a/pumpkin/src/entity/type.rs +++ b/pumpkin/src/entity/type.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use pumpkin_data::entity::{EntityType, MobCategory}; +use pumpkin_data::entity::EntityType; use pumpkin_util::math::vector3::Vector3; use uuid::Uuid; @@ -28,10 +28,10 @@ pub async fn from_type( id if id == EntityType::END_CRYSTAL.id => Arc::new(EndCrystalEntity::new(entity)), // Fallback Entity _ => { - if entity_type.category == &MobCategory::MISC { - Arc::new(entity) - } else { + if entity_type.max_health.is_some() { Arc::new(LivingEntity::new(entity)) + } else { + Arc::new(entity) } } };