DamageableComponent

public class DamageableComponent

Represents a component that can handle damage interactions, including applying damage from various sources and managing the internal health of an associated modeled entity. This component is responsible for processing both custom damage and Minecraft's native damage system, depending on the context and the underlying entity type.

Constructors

Link copied to clipboard
public void DamageableComponent(ModeledEntity modeledEntity)

Properties

Link copied to clipboard
public double internalHealth
Represents the internal health of an entity.

Functions

Link copied to clipboard
public void attack(LivingEntity target)
This is the preferred way to attack a living entity if you have a living entity as the underlying entity.
public void attack(LivingEntity target, double damage)
Beware, this damage uses custom damage which might get reduced somewhat randomly by Minecraft, so test it before using it.
Link copied to clipboard
public void damage(double amount)
public void damage(Entity damager)
public boolean damage(Projectile projectile)
public void damage(Entity damager, double amount)
Link copied to clipboard
public double getInternalHealth()
Represents the internal health of an entity.
Link copied to clipboard
public void setInternalHealth(double internalHealth)
Represents the internal health of an entity.