Why would a module need to be -downloaded- when loading/unloading a module? I'd normally think a module is normally already downloaded and installed in the right place by the time the user attempts to enable it.
Modules are enabled on the server and every client. When a client connects to a server they are sent any modules they are missing that are active on the server, not any inactive modules. If you activate a module midgame, presumably you do that on the server and the enabling of that modules would be pushed to every client. There's no guarantee every client will have the module.
Obviously this is ignoring the possibility of client-side only modules (like skin packs). In theory we could have these, but I'm inclined to have the server determine the look and feel rather than allowing every client to determine their own look and feel and have players seeing different things to each other - this always bothered me in Minecraft. Could add support for this in the future - it would be restricted to codeless modules, because we certainly shouldn't encourage client-side mods with code.
I believe this can be addressed by having one (or more) classloader per module and GC'ing the classloader(s) of a module before a replacement is loaded. OSGI framework implementations need to do this for their bundles lifecycle. But I completely agree with you it wouldn't have to happen in-game. It'd be fancy... but probably just that.
Yeah, I know there are solutions in this space. It gets complex because of module dependencies, but it is theoretically doable. For now I've left it with a single, sandboxing class loader for all modules.
I'd imagine a module defining new blocks could also be forced to define a default "fallback" block for this occurrence? I.e. a new type of stone could fallback into the default stone block?
Yes. Slight complication is that the fallback information would have to be stored in the saved game because it won't be available otherwise, but nothing major blocking this. It is in my longer-term todo list.
That's interesting. How does that happen? Are there objects watching the asset folders or do you need to trigger it somehow? Is this documented somewhere?
At the moment you do it manually, with a console command. Java 7 does have support for watching files for changes, but I haven't pushed it that far yet. There's only commands for a couple of asset types at the moment (reloadSkin, reloadShader, reloadMaterial) but that can easily be addressed. Documented in the ingame console help.
Basically the asset system was designed from the ground up to support this, and it leverages the same core functionality that allows procedural asset creation, multiple filetype support and override support.