Instead of counting all values larger than or equal 1000 as "Ambient Lighting Gamma", only count 1000 itself as "Ambient Lighting Gamma". So unless a Player manually sets his Gamma Value to 1000, the Brightness won't be reset to "Moody" anymore - before this change, every value larger than 1000 would be reset to "Moody" as well.
This commit is contained in:
@@ -6,6 +6,9 @@ import net.minecraft.client.settings.GameSettings.Options;
|
|||||||
|
|
||||||
public class LightingHandler {
|
public class LightingHandler {
|
||||||
|
|
||||||
|
//I've picked this value because it's very unlikely someone is going to set it manually
|
||||||
|
private static final float AMBIENT_GAMMA = 1000;
|
||||||
|
|
||||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
private static float initialGamma = 0;
|
private static float initialGamma = 0;
|
||||||
@@ -15,11 +18,11 @@ public class LightingHandler {
|
|||||||
public static void setLighting(boolean lighting) {
|
public static void setLighting(boolean lighting) {
|
||||||
|
|
||||||
float gamma = mc.gameSettings.getOptionFloatValue(Options.GAMMA);
|
float gamma = mc.gameSettings.getOptionFloatValue(Options.GAMMA);
|
||||||
if(gamma < 1000) {
|
if(gamma != AMBIENT_GAMMA) {
|
||||||
initialGamma = gamma;
|
initialGamma = gamma;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(lighting) mc.gameSettings.setOptionFloatValue(Options.GAMMA, 1000);
|
if(lighting) mc.gameSettings.setOptionFloatValue(Options.GAMMA, AMBIENT_GAMMA);
|
||||||
else mc.gameSettings.setOptionFloatValue(Options.GAMMA, initialGamma);
|
else mc.gameSettings.setOptionFloatValue(Options.GAMMA, initialGamma);
|
||||||
|
|
||||||
enabled = lighting;
|
enabled = lighting;
|
||||||
|
|||||||
Reference in New Issue
Block a user