001package net.minecraft.entity.projectile; 002 003import net.minecraft.entity.EntityLiving; 004import net.minecraft.entity.monster.EntityBlaze; 005import net.minecraft.util.DamageSource; 006import net.minecraft.util.MovingObjectPosition; 007import net.minecraft.world.World; 008 009public class EntitySnowball extends EntityThrowable 010{ 011 public EntitySnowball(World par1World) 012 { 013 super(par1World); 014 } 015 016 public EntitySnowball(World par1World, EntityLiving par2EntityLiving) 017 { 018 super(par1World, par2EntityLiving); 019 } 020 021 public EntitySnowball(World par1World, double par2, double par4, double par6) 022 { 023 super(par1World, par2, par4, par6); 024 } 025 026 /** 027 * Called when this EntityThrowable hits a block or entity. 028 */ 029 protected void onImpact(MovingObjectPosition par1MovingObjectPosition) 030 { 031 if (par1MovingObjectPosition.entityHit != null) 032 { 033 byte b0 = 0; 034 035 if (par1MovingObjectPosition.entityHit instanceof EntityBlaze) 036 { 037 b0 = 3; 038 } 039 040 par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), b0); 041 } 042 043 for (int i = 0; i < 8; ++i) 044 { 045 this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); 046 } 047 048 if (!this.worldObj.isRemote) 049 { 050 this.setDead(); 051 } 052 } 053}