package common.entity.projectile;

import common.entity.DamageSource;
import common.entity.types.EntityLiving;
import common.entity.types.EntityThrowable;
import common.init.Config;
import common.model.ParticleType;
import common.util.HitPosition;
import common.world.World;

public class EntitySnowball extends EntityThrowable
{
    public EntitySnowball(World worldIn)
    {
        super(worldIn);
    }

    public EntitySnowball(World worldIn, EntityLiving throwerIn)
    {
        super(worldIn, throwerIn);
    }

    public EntitySnowball(World worldIn, double x, double y, double z)
    {
        super(worldIn, x, y, z);
    }

    /**
     * Called when this EntityThrowable hits a block or entity.
     */
    protected void onImpact(HitPosition p_70184_1_)
    {
        if (p_70184_1_.entity != null)
        {
//            int i = 0;

//            if (p_70184_1_.entityHit instanceof EntityBlaze && Config.blazeSnowballDamage)
//            {
//                i = 3;
//            }

            if(Config.knockSnowball)
            	p_70184_1_.entity.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
        }

        for (int j = 0; j < 8; ++j)
        {
            this.worldObj.spawnParticle(ParticleType.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
        }

        if (!this.worldObj.client)
        {
            this.setDead();
        }
    }
}
