    001package net.minecraft.util;
    002
    003import net.minecraft.entity.Entity;
    004import net.minecraft.entity.EntityLiving;
    005import net.minecraft.item.ItemStack;
    006
    007public class EntityDamageSourceIndirect extends EntityDamageSource
    008{
    009    private Entity indirectEntity;
    010
    011    public EntityDamageSourceIndirect(String par1Str, Entity par2Entity, Entity par3Entity)
    012    {
    013        super(par1Str, par2Entity);
    014        this.indirectEntity = par3Entity;
    015    }
    016
    017    public Entity getSourceOfDamage()
    018    {
    019        return this.damageSourceEntity;
    020    }
    021
    022    public Entity getEntity()
    023    {
    024        return this.indirectEntity;
    025    }
    026
    027    /**
    028     * Returns the message to be displayed on player death.
    029     */
    030    public String getDeathMessage(EntityLiving par1EntityLiving)
    031    {
    032        String s = this.indirectEntity == null ? this.damageSourceEntity.func_96090_ax() : this.indirectEntity.func_96090_ax();
    033        ItemStack itemstack = this.indirectEntity instanceof EntityLiving ? ((EntityLiving)this.indirectEntity).getHeldItem() : null;
    034        String s1 = "death.attack." + this.damageType;
    035        String s2 = s1 + ".item";
    036        return itemstack != null && itemstack.hasDisplayName() && StatCollector.func_94522_b(s2) ? StatCollector.translateToLocalFormatted(s2, new Object[] {par1EntityLiving.func_96090_ax(), s, itemstack.getDisplayName()}): StatCollector.translateToLocalFormatted(s1, new Object[] {par1EntityLiving.func_96090_ax(), s});
    037    }
    038}