package net.minecraft.util; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; public class EntityDamageSource extends DamageSource { protected Entity damageSourceEntity; public EntityDamageSource(String par1Str, Entity par2Entity) { super(par1Str); this.damageSourceEntity = par2Entity; } public Entity getEntity() { return this.damageSourceEntity; } /** * Returns the message to be displayed on player death. */ public String getDeathMessage(EntityPlayer par1EntityPlayer) { return StatCollector.translateToLocalFormatted("death." + this.damageType, new Object[] {par1EntityPlayer.username, this.damageSourceEntity.getEntityName()}); } /** * Return whether this damage source will have its damage amount scaled based on the current difficulty. */ public boolean isDifficultyScaled() { return this.damageSourceEntity != null && this.damageSourceEntity instanceof EntityLiving && !(this.damageSourceEntity instanceof EntityPlayer); } }