This is a small mod that improves lighting in Beta. Mod is completely client side.
Content list:
- Color lights (for any light sources including modded);
- API for light sources registration;
- Custom AO calculation.
Compatibility:
- Compatible with GLSL (tested);
- Compatible with BNB (will also have internal support);
- Should be compatible with other rendering-related mods.
Realisation Details:
- Colored lights uses simple linear interpolations and vertex coloring;
- AO uses some smart calculations to prevent too dark areas and light leaks;
Realisation Limitation:
- Colored light only affect small area around block;
- Light mixing can result with white color;
- Light sources are not too bright.
Requires Fabric Legacy and Station API (1.3.1)
- Download MultiMC instance and import it as zip
- Download Station API and import it as a mod in MultiMC
- Import this mod
- Dev: "gradlew eclipse" or "gradlew rebuildLVT genSources eclipse"
- Build: "gradlew build"
You can add custom light sources inside special registration event.
Note: Light source shouldn't have vanilla emission, it can be any block (like, for example, wool).
Event registration:
LightRegistry.EVENT.register(new LightRegistry() {
// Register light for specified block ID & meta
LightColors.setBlockLight(your_block_id, your_block_meta, color);
// Register light for specified block ID
// Will be applied to all meta values
// (Except meta that was already defined by function above)
LightColors.setBlockLight(your_block_id, color);
// Same as the first function, but takes a block instead of integer
LightColors.setBlockLight(your_block, your_block_meta, color);
// Same as the second function, but takes a block instead of integer
LightColors.setBlockLight(your_block, color);
}
Color is an integer color representation (6 bites), there are some helpful functions to calculate this value from RGB or from hex string:
int rgbColor = LightColors.getColor(r, g, b); // Color from RRB ints [0-255]
int hexColor = LightColors.getColor("ffffff"); // White color
// Will calculate average color of bright texture pixels
// Should be called only inside LightRegistry event
int texColor = LightColors.getTextureColor(textureID);
// Will return vanilla (tweaked) color
// Same meta order as dyes have
// based on brighten wool colors
int dyeColor = LightColors.getVanillaLight(meta);
You can also use Java AWT color RGB value as a color:
LightRegistry.EVENT.register(new LightRegistry() {
LightColors.setBlockLight(BlockBase.WOOD, Color.RED.getRGB());
}