Lots of refactoring for the planned API. Added an ILight interface that mod developers can implement for custom lighting.