made new light optional with internal boolean

This commit is contained in:
cola98765
2021-10-16 11:25:13 +02:00
parent 37995af19e
commit 893bfa096f
2 changed files with 25 additions and 9 deletions
@@ -85,6 +85,8 @@ public class LodBuilder
/** Minecraft's max light value */
public static final short DEFAULT_MAX_LIGHT = 15;
//TODO make it config
public static final boolean USE_EXPERIMENTAL_SKYLIGHT = false;
/**
* How wide LodDimensions should be in regions <br>
@@ -439,21 +441,34 @@ public class LodBuilder
skyLight = DEFAULT_MAX_LIGHT;
else
{
skyLight = world.getBrightness(LightType.SKY, blockPos);
if (skyLight > 15 || skyLight < 0)
ClientProxy.LOGGER.warn("is this helpful? " + skyLight);
if (!chunk.isLightCorrect() && (skyLight == 0 || skyLight == 15))
if (USE_EXPERIMENTAL_SKYLIGHT)
{
skyLight = world.getBrightness(LightType.SKY, blockPos);
if (!chunk.isLightCorrect() && (skyLight == 0 || skyLight == 15))
{
// we don't know what the light here is,
// lets just take a guess
if (blockPos.getY() >= mc.getClientWorld().getSeaLevel() - 5)
{
skyLight = 12;
isDefault = 1;
}
else
skyLight = 0;
}
}
else
{
// we don't know what the light here is,
// lets just take a guess
if (blockPos.getY() >= mc.getClientWorld().getSeaLevel() - 5)
{
skyLight = 12;
isDefault = 1;
}
else
skyLight = 0;
}
if (skyLight == 15)
ClientProxy.LOGGER.warn("skylight 15 while not top block");
//if (skyLight == 15)
// ClientProxy.LOGGER.warn("skylight 15 while not top block");
}
blockLight = world.getBrightness(LightType.BLOCK, blockPos);
@@ -4,6 +4,7 @@ import com.seibel.lod.enums.DistanceGenerationMode;
import net.minecraft.client.renderer.texture.NativeImage;
import static com.seibel.lod.builders.bufferBuilding.LodBufferBuilder.skyLightPlayer;
import static com.seibel.lod.builders.lodBuilding.LodBuilder.USE_EXPERIMENTAL_SKYLIGHT;
public class DataPointUtil
{
@@ -153,7 +154,7 @@ public class DataPointUtil
public static int getLightSkyAlt(long dataPoint)
{
if (skyLightPlayer == 0 && ((dataPoint >>> FLAG_SHIFT) & FLAG_MASK) == 1)
if (USE_EXPERIMENTAL_SKYLIGHT && skyLightPlayer == 0 && ((dataPoint >>> FLAG_SHIFT) & FLAG_MASK) == 1)
return 0;
else
return (int) ((dataPoint >>> SKY_LIGHT_SHIFT) & SKY_LIGHT_MASK);