    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005
    006    public class EntityWitherSkull extends EntityFireball
    007    {
    008        public EntityWitherSkull(World par1World)
    009        {
    010            super(par1World);
    011            this.setSize(0.3125F, 0.3125F);
    012        }
    013
    014        public EntityWitherSkull(World par1World, EntityLiving par2EntityLiving, double par3, double par5, double par7)
    015        {
    016            super(par1World, par2EntityLiving, par3, par5, par7);
    017            this.setSize(0.3125F, 0.3125F);
    018        }
    019
    020        protected float func_82341_c()
    021        {
    022            return this.func_82342_d() ? 0.73F : super.func_82341_c();
    023        }
    024
    025        @SideOnly(Side.CLIENT)
    026        public EntityWitherSkull(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
    027        {
    028            super(par1World, par2, par4, par6, par8, par10, par12);
    029            this.setSize(0.3125F, 0.3125F);
    030        }
    031
    032        /**
    033         * Returns true if the entity is on fire. Used by render to add the fire effect on rendering.
    034         */
    035        public boolean isBurning()
    036        {
    037            return false;
    038        }
    039
    040        public float func_82146_a(Explosion par1Explosion, Block par2Block, int par3, int par4, int par5)
    041        {
    042            float var6 = super.func_82146_a(par1Explosion, par2Block, par3, par4, par5);
    043
    044            if (this.func_82342_d() && par2Block != Block.bedrock)
    045            {
    046                var6 = Math.min(0.8F, var6);
    047            }
    048
    049            return var6;
    050        }
    051
    052        /**
    053         * Called when this EntityFireball hits a block or entity.
    054         */
    055        protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
    056        {
    057            if (!this.worldObj.isRemote)
    058            {
    059                if (par1MovingObjectPosition.entityHit != null)
    060                {
    061                    if (this.shootingEntity != null)
    062                    {
    063                        if (par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8) && !par1MovingObjectPosition.entityHit.isEntityAlive())
    064                        {
    065                            this.shootingEntity.heal(5);
    066                        }
    067                    }
    068                    else
    069                    {
    070                        par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.magic, 5);
    071                    }
    072
    073                    if (par1MovingObjectPosition.entityHit instanceof EntityLiving)
    074                    {
    075                        byte var2 = 0;
    076
    077                        if (this.worldObj.difficultySetting > 1)
    078                        {
    079                            if (this.worldObj.difficultySetting == 2)
    080                            {
    081                                var2 = 10;
    082                            }
    083                            else if (this.worldObj.difficultySetting == 3)
    084                            {
    085                                var2 = 40;
    086                            }
    087                        }
    088
    089                        if (var2 > 0)
    090                        {
    091                            ((EntityLiving)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.field_82731_v.id, 20 * var2, 1));
    092                        }
    093                    }
    094                }
    095
    096                this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.worldObj.func_82736_K().func_82766_b("mobGriefing"));
    097                this.setDead();
    098            }
    099        }
    100
    101        /**
    102         * Returns true if other Entities should be prevented from moving through this Entity.
    103         */
    104        public boolean canBeCollidedWith()
    105        {
    106            return false;
    107        }
    108
    109        /**
    110         * Called when the entity is attacked.
    111         */
    112        public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
    113        {
    114            return false;
    115        }
    116
    117        protected void entityInit()
    118        {
    119            this.dataWatcher.addObject(10, Byte.valueOf((byte)0));
    120        }
    121
    122        public boolean func_82342_d()
    123        {
    124            return this.dataWatcher.getWatchableObjectByte(10) == 1;
    125        }
    126
    127        public void func_82343_e(boolean par1)
    128        {
    129            this.dataWatcher.updateObject(10, Byte.valueOf((byte)(par1 ? 1 : 0)));
    130        }
    131    }