Earlier quoted context omitted.
I know it sounds cruel and I didn't feel quite right doing it but this is why I walk around my cats like they're not there. After a couple close calls where I almost fell it seemed like it was worth a shot. I do slow down a bit so I carry/push them rather than kick when they're actually underfoot though. It only took a couple bonks to the nose and a time or two of being carried by my foot a few inches into the air to…
I've used something similar to teach a kitten I had to not step on keyboards. Just pick them up and drop them on the floor every time they touch the keyboard - they learn that that touching keyboards is How You Fall Off The Desk.
To curb this behavior, one of us would grab him off the shelf and literally throw him outside (onto grass, maybe 6' in the air), thinking that he would associate the unpleasantness of being thrown with his unwanted behavior.
He did. He changed his behavior such that he would jump up on said shelves and deliberately knock things off the shelf whenever he wanted to go outside.
He was a great cat other than that habit though. Hands down the most social (with humans) cat I have ever owned or met and my sample size on both counts is fairly large. He made everyone he met fall in love with him and had a territory of several square miles given the phone calls from people he encountered who took him in worrying that he wouldn't get home safely (he always did, though one incident when he was gone overnight prompted us to put the home phone number on his collar due to some concerned neighbor who took him in for the night). He also once jumped into a UPS truck that was delivering a package to my parents house - I happened to be looking out the window as the truck was leaving, watched it go halfway up the driveway, stop, and see the driver toss him out of the truck.
My parents have since stopped allowing their cats outside due to the murderous relationship between cats and local bird populations.