DarknessLib
DarknessLib is a library mod that provides tools for working with lighting calculations in Minecraft. As a library, it doesn't add game content itself but serves as a foundation for other modifications, allowing developers to avoid code duplication when implementing similar functions.
Main Features
The library includes several key functions:
- Relative light level calculation - takes into account various factors, including the character being in soul sand
- Support for popular dynamic lighting mods - compatibility with Atomic Stryker's Dynamic Lights, Optifine Dynamic Lights, and Smooth Entity Light. Functionality works on a per-player basis, ensuring consistency between client and server
- Automatic light source detection - the library independently analyzes registered blocks and identifies those that emit light
- Vehicle list - built-in inventory of objects (minecarts, boats) that affect light level when inside
- IMC support - allows other mods to add their own vehicles and light sources to the appropriate lists
Configuration Settings
The mod offers several configuration options:
Dynamic Lights List Items and blocks added to this list will be recognized as portable light sources when compatible dynamic lighting mods are present. Most glowing blocks are detected automatically - check the game log to view detected sources.
Entry format: modid:name:meta;light_level, where meta and light_level are optional parameters (light level defaults to 15).
Minecraft restart required!
Dynamic Lights Mode When this option is activated (on client and server), portable light sources will be considered in lighting calculations when supported mods are present.
Integration with Other Mods
To add vehicles from your mod, use the following code:
FMLInterModComms.sendMessage("darknesslib", "addVehicle", "path.to.mod.Entity");
To add portable light sources:
FMLInterModComms.sendMessage("darknesslib", "addLightsource", new ItemStack(INSERT_ITEM_REFERENCE_HERE));
FMLInterModComms.sendMessage("darknesslib", "addLightsource", "modid:name:meta;light_level");
Compatibility
The library includes built-in support for vehicles from MrCrayfish's Vehicle Mod.
Mods Using DarknessLib
- Grue (starting from version 1.6.0)
- Hungering Darkness (starting from version 1.3.0)