namespace Minecraft.Server.FourKit.Entity; /// /// Represents a living entity in the world that has health and can take damage. /// public class LivingEntity : Damageable { private double _eyeHeight = 1.62; internal LivingEntity() { } internal LivingEntity(int entityId, EntityType entityType, int dimId, double x, double y, double z, float health = 20f, float maxHealth = 20f) { SetEntityIdInternal(entityId); SetEntityTypeInternal(entityType); SetDimensionInternal(dimId); SetLocation(new Location(FourKit.getWorld(dimId), x, y, z)); if (maxHealth > 0) SetMaxHealthInternal(maxHealth); SetHealthInternal(health); } /// /// Gets the height of the living entity's eyes above its . /// /// The eye height. public double getEyeHeight() => _eyeHeight; /// /// Gets the height of the living entity's eyes above its . /// /// If true, returns the standing eye height regardless of sneak state. /// The eye height. public double getEyeHeight(bool ignoreSneaking) { if (ignoreSneaking) return _eyeHeight; // When sneaking the eye height is slightly lower return _eyeHeight - 0.08; } // --- Internal setter used by the bridge --- /// /// Updates the eye height. Called internally by the bridge. /// /// The new eye height. internal void SetEyeHeightInternal(double eyeHeight) => _eyeHeight = eyeHeight; }