fix lighting

This commit is contained in:
Sen 2025-07-17 17:28:30 +02:00
parent 2ea8656390
commit 3a9ec2ab32
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
14 changed files with 169 additions and 399 deletions

View file

@ -49,16 +49,7 @@ import common.util.Vec3;
import common.vars.Vars;
public abstract class World implements IWorldAccess {
public static final float[][] BRIGHTNESS = new float[16][16];
static {
for(int bright = 0; bright < 16; bright++) {
float br = (float)bright / 15.0f;
for(int idx = 0; idx <= 15; idx++) {
float sub = 1.0F - (float)idx / 15.0F;
BRIGHTNESS[bright][idx] = (1.0F - sub) / (sub * 3.0F + 1.0F) * (1.0F - br) + br;
}
}
}
public static final float[] BRIGHTNESS = new float[] {0.0f, 0.02f, 0.04f, 0.06f, 0.08f, 0.11f, 0.14f, 0.18f, 0.22f, 0.27f, 0.33f, 0.41f, 0.5f, 0.62f, 0.78f, 1.0f};
public static final float[] MOON_PHASES = new float[] {1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F};
public static final int MAX_SIZE = 67108864;
public static final int MAX_SIZE_Y = 4096;
@ -568,7 +559,7 @@ public abstract class World implements IWorldAccess {
}
public float getLightBrightness(BlockPos pos) {
return BRIGHTNESS[this.dimension.getBrightness()][this.getLightFromNeighbors(pos)];
return Math.max(BRIGHTNESS[this.getLightFromNeighbors(pos)], (float)this.dimension.getBrightness() / 15.0f);
}
public State getState(BlockPos pos) {