package telinc.telicraft.util;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.StatCollector;

public class PetrifyDamageSource extends TelicraftDamageSource {
    protected EntityLivingBase entity;

    protected PetrifyDamageSource(EntityLivingBase par1EntityLivingBase) {
        super("petrify");
        this.setDamageAllowedInCreativeMode();
        this.setDamageBypassesArmor();
        this.entity = par1EntityLivingBase;
    }

    @Override
    public Entity getEntity() {
        return this.entity;
    }

    @Override
    public ChatMessageComponent getDeathMessage(EntityLivingBase par1EntityLivingBase) {
        EntityLivingBase attacker = par1EntityLivingBase.func_94060_bK();
        String deathSelf = this.getRawDeathMessage();
        String deathPlayer = deathSelf + ".player";
        return attacker != null && StatCollector.func_94522_b(deathPlayer) ? ChatMessageComponent.func_111082_b(deathPlayer, new Object[]{par1EntityLivingBase.getTranslatedEntityName(), attacker.getTranslatedEntityName()}) : ChatMessageComponent.func_111082_b(deathSelf, new Object[]{par1EntityLivingBase.getTranslatedEntityName()});
    }
}
