Welcome to world of programming my friend!

Well I think you could solve the easy problem of small z movements yourself, but it seems you dont want to detect a z velocity at all! Maybe, you want to detect something like if the entity has ground contact or not?
When programming its good to make up your mind beforehand as precisely as possible what you need and want, cos otherwise you waste time by trying other solutions only to find out that this wasnt what you wanted after all.