diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java index 549c0dfb96..283c6f5c9b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java @@ -1,9 +1,11 @@ package org.bukkit.craftbukkit.entity; +import net.minecraft.server.DamageSource; import net.minecraft.server.EntityComplex; -import net.minecraft.server.EntityLiving; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexLivingEntity; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.LivingEntity; public abstract class CraftComplexLivingEntity extends CraftLivingEntity implements ComplexLivingEntity { public CraftComplexLivingEntity(CraftServer server, EntityComplex entity) { @@ -19,4 +21,21 @@ public abstract class CraftComplexLivingEntity extends CraftLivingEntity impleme public String toString() { return "CraftComplexLivingEntity"; } + + @Override + public void damage(int amount, org.bukkit.entity.Entity source) { + DamageSource reason = DamageSource.GENERIC; + + if (source instanceof HumanEntity) { + reason = DamageSource.playerAttack(((CraftHumanEntity) source).getHandle()); + } else if (source instanceof LivingEntity) { + reason = DamageSource.mobAttack(((CraftLivingEntity) source).getHandle()); + } + + if (entity instanceof EntityComplex) { + ((EntityComplex) entity).e(reason, amount); + } else { + entity.damageEntity(reason, amount); + } + } }