001package net.minecraft.entity.projectile;
002
003import cpw.mods.fml.relauncher.Side;
004import cpw.mods.fml.relauncher.SideOnly;
005import net.minecraft.entity.Entity;
006import net.minecraft.entity.EntityLiving;
007import net.minecraft.nbt.NBTTagCompound;
008import net.minecraft.util.DamageSource;
009import net.minecraft.util.MovingObjectPosition;
010import net.minecraft.world.World;
011
012public class EntityLargeFireball extends EntityFireball
013{
014    public int field_92057_e = 1;
015
016    public EntityLargeFireball(World par1World)
017    {
018        super(par1World);
019    }
020
021    @SideOnly(Side.CLIENT)
022    public EntityLargeFireball(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
023    {
024        super(par1World, par2, par4, par6, par8, par10, par12);
025    }
026
027    public EntityLargeFireball(World par1World, EntityLiving par2EntityLiving, double par3, double par5, double par7)
028    {
029        super(par1World, par2EntityLiving, par3, par5, par7);
030    }
031
032    /**
033     * Called when this EntityFireball hits a block or entity.
034     */
035    protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
036    {
037        if (!this.worldObj.isRemote)
038        {
039            if (par1MovingObjectPosition.entityHit != null)
040            {
041                par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, this.shootingEntity), 6);
042            }
043
044            this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, (float)this.field_92057_e, true, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
045            this.setDead();
046        }
047    }
048
049    /**
050     * (abstract) Protected helper method to write subclass entity data to NBT.
051     */
052    public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
053    {
054        super.writeEntityToNBT(par1NBTTagCompound);
055        par1NBTTagCompound.setInteger("ExplosionPower", this.field_92057_e);
056    }
057
058    /**
059     * (abstract) Protected helper method to read subclass entity data from NBT.
060     */
061    public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
062    {
063        super.readEntityFromNBT(par1NBTTagCompound);
064
065        if (par1NBTTagCompound.hasKey("ExplosionPower"))
066        {
067            this.field_92057_e = par1NBTTagCompound.getInteger("ExplosionPower");
068        }
069    }
070}