Exemplo n.º 1
0
        /// <summary>
        /// Called when the mob's health reaches 0.
        /// </summary>
        public override void OnDeath(DamageSource par1DamageSource)
        {
            base.OnDeath(par1DamageSource);

            if ((par1DamageSource.GetSourceOfDamage() is EntityArrow) && (par1DamageSource.GetEntity() is EntityPlayer))
            {
                EntityPlayer entityplayer = (EntityPlayer)par1DamageSource.GetEntity();
                double       d            = entityplayer.PosX - PosX;
                double       d1           = entityplayer.PosZ - PosZ;

                if (d * d + d1 * d1 >= 2500D)
                {
                    entityplayer.TriggerAchievement(AchievementList.SnipeSkeleton);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called when the entity is attacked.
        /// </summary>
        public override bool AttackEntityFrom(DamageSource par1DamageSource, int par2)
        {
            if (base.AttackEntityFrom(par1DamageSource, par2))
            {
                Entity entity = par1DamageSource.GetEntity();

                if (RiddenByEntity == entity || RidingEntity == entity)
                {
                    return(true);
                }

                if (entity != this)
                {
                    EntityToAttack = entity;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }