Hello, been searching around for a while trying to figure this out but I'm stumped. I'm trying to return the players light level, this should include skylight and block-light. This code below works but doesn't take into account for the actual brightness it is at different times of the day since it will always be 15. Is there any function that can help me accomplish this? I've tried getting the information from chunks, lightEngine, and still not the result I want. Thanks in advance.
// Returns the brightness around the players position
public static float lightLevel() {
Minecraft minecraft = Minecraft.getInstance();
Level world = minecraft.level;
BlockPos playerPos = minecraft.player.blockPosition();
var blockLight = world.getBrightness(LightLayer.BLOCK, playerPos);
var skyLight = world.getBrightness(LightLayer.SKY, playerPos);
System.out.println("Blocklight: " + blockLight);
System.out.println("SkyLight: " + skyLight);
return world.getBrightness(LightLayer.BLOCK, playerPos) + world.getBrightness(LightLayer.SKY, playerPos);
}