Ejemplo n.º 1
0
        /// <summary>
        /// Checks to see if this enderman should be attacking this player
        /// </summary>
        private bool ShouldAttackPlayer(EntityPlayer par1EntityPlayer)
        {
            ItemStack itemstack = par1EntityPlayer.Inventory.ArmorInventory[3];

            if (itemstack != null && itemstack.ItemID == Block.Pumpkin.BlockID)
            {
                return(false);
            }

            Vec3D  vec3d  = par1EntityPlayer.GetLook(1.0F).Normalize();
            Vec3D  vec3d1 = Vec3D.CreateVector(PosX - par1EntityPlayer.PosX, (BoundingBox.MinY + (double)(Height / 2.0F)) - (par1EntityPlayer.PosY + (double)par1EntityPlayer.GetEyeHeight()), PosZ - par1EntityPlayer.PosZ);
            double d      = vec3d1.LengthVector();

            vec3d1 = vec3d1.Normalize();
            double d1 = vec3d.DotProduct(vec3d1);

            if (d1 > 1.0D - 0.025000000000000001D / d)
            {
                return(par1EntityPlayer.CanEntityBeSeen(this));
            }
            else
            {
                return(false);
            }
        }