Most mods have a license of some sort. If you don't make any money from your mods then you can claim Fair Use Educational rights unless their license specifically forbids it. And it's not usually a problem if all you do is reference (no copy-paste) their code. Never copy-paste code.
I don't usually go as far as looking at someone's code for help. Most of the time I can find a tutorial for some version of MC and adapt it for whatever version I'm working with.