    001package net.minecraft.entity.projectile;
    002
    003import net.minecraft.block.Block;
    004import net.minecraft.entity.EntityLiving;
    005import net.minecraft.util.DamageSource;
    006import net.minecraft.util.MovingObjectPosition;
    007import net.minecraft.world.World;
    008
    009public class EntitySmallFireball extends EntityFireball
    010{
    011    public EntitySmallFireball(World par1World)
    012    {
    013        super(par1World);
    014        this.setSize(0.3125F, 0.3125F);
    015    }
    016
    017    public EntitySmallFireball(World par1World, EntityLiving par2EntityLiving, double par3, double par5, double par7)
    018    {
    019        super(par1World, par2EntityLiving, par3, par5, par7);
    020        this.setSize(0.3125F, 0.3125F);
    021    }
    022
    023    public EntitySmallFireball(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
    024    {
    025        super(par1World, par2, par4, par6, par8, par10, par12);
    026        this.setSize(0.3125F, 0.3125F);
    027    }
    028
    029    /**
    030     * Called when this EntityFireball hits a block or entity.
    031     */
    032    protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
    033    {
    034        if (!this.worldObj.isRemote)
    035        {
    036            if (par1MovingObjectPosition.entityHit != null)
    037            {
    038                if (!par1MovingObjectPosition.entityHit.isImmuneToFire() && par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 5))
    039                {
    040                    par1MovingObjectPosition.entityHit.setFire(5);
    041                }
    042            }
    043            else
    044            {
    045                int i = par1MovingObjectPosition.blockX;
    046                int j = par1MovingObjectPosition.blockY;
    047                int k = par1MovingObjectPosition.blockZ;
    048
    049                switch (par1MovingObjectPosition.sideHit)
    050                {
    051                    case 0:
    052                        --j;
    053                        break;
    054                    case 1:
    055                        ++j;
    056                        break;
    057                    case 2:
    058                        --k;
    059                        break;
    060                    case 3:
    061                        ++k;
    062                        break;
    063                    case 4:
    064                        --i;
    065                        break;
    066                    case 5:
    067                        ++i;
    068                }
    069
    070                if (this.worldObj.isAirBlock(i, j, k))
    071                {
    072                    this.worldObj.setBlock(i, j, k, Block.fire.blockID);
    073                }
    074            }
    075
    076            this.setDead();
    077        }
    078    }
    079
    080    /**
    081     * Returns true if other Entities should be prevented from moving through this Entity.
    082     */
    083    public boolean canBeCollidedWith()
    084    {
    085        return false;
    086    }
    087
    088    /**
    089     * Called when the entity is attacked.
    090     */
    091    public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
    092    {
    093        return false;
    094    }
    095}