Yes, Mojang/MS don't claim copyright on your code. However, they can (and do, in the EULA) make restrictions about what you are allowed to distribute as a mod (remember the issue about deliberately crashing code/player blacklists in some mods), and how you can use it together with Minecraft...