Instead of ticking the world once (which updated entities and such), simply set the EntityRenderer's lightmapUpdateNeeded to true when updating Ambient Lighting

Properly handle manual Gamma changes in LightingHandler not to confuse users why their Brightness setting is being reset constantly
This commit is contained in:
CrushedPixel
2015-07-24 14:35:28 +02:00
parent bdd9d1da33
commit 7b67fb4242
2 changed files with 12 additions and 16 deletions

View File

@@ -11,26 +11,21 @@ public class LightingHandler {
private static float initialGamma = 0;
private static boolean enabled = false;
public static void setLighting(boolean lighting) {
if(lighting) {
if(!enabled) {
initialGamma = Minecraft.getMinecraft().gameSettings.getOptionFloatValue(Options.GAMMA);
}
Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.GAMMA, 1000);
} else Minecraft.getMinecraft().gameSettings.setOptionFloatValue(Options.GAMMA, initialGamma);
float gamma = mc.gameSettings.getOptionFloatValue(Options.GAMMA);
if(gamma < 1000) {
initialGamma = gamma;
}
if(lighting) mc.gameSettings.setOptionFloatValue(Options.GAMMA, 1000);
else mc.gameSettings.setOptionFloatValue(Options.GAMMA, initialGamma);
enabled = lighting;
try {
if(ReplayMod.replaySender.paused()) {
mc.timer.elapsedPartialTicks += 1;
mc.timer.renderPartialTicks += 1;
} else {
Minecraft.getMinecraft().entityRenderer.updateCameraAndRender(0);
}
} catch(Exception e) {
e.printStackTrace();
if(ReplayMod.replaySender.paused()) {
mc.entityRenderer.lightmapUpdateNeeded = true;
}
}