Added Eyecon as indicator that Ambient Lighting is enabled
Added ShutdownHook to Lighting Handler to prevent high Brightness Values from being saved
This commit is contained in:
@@ -448,6 +448,22 @@ public class GuiReplayOverlay extends Gui {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the eye icon in the bottom right corner of the screen.
|
||||
* @param event Rendered post game overlay
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void renderLightingIndicator(RenderGameOverlayEvent.Post event) {
|
||||
if (event.type != RenderGameOverlayEvent.ElementType.ALL) return;
|
||||
if(ReplayMod.replaySettings.isLightingEnabled() && ReplayHandler.isInReplay()) {
|
||||
mc.renderEngine.bindTexture(replay_gui);
|
||||
GlStateManager.resetColor();
|
||||
GlStateManager.enableAlpha();
|
||||
Gui.drawModalRectWithCustomSizedTexture(WIDTH - 10 - 19, HEIGHT - 10 - 13,
|
||||
90, 20, 19, 13, TEXTURE_SIZE, TEXTURE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy interface for GUI on which this replay overlay shall not be rendered.
|
||||
*/
|
||||
|
||||
@@ -7,12 +7,12 @@ import net.minecraft.client.settings.GameSettings.Options;
|
||||
|
||||
public class LightingHandler {
|
||||
|
||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
private static float initialGamma = 0;
|
||||
|
||||
private static boolean enabled = false;
|
||||
|
||||
//TODO: Properly reset Gamma on game start
|
||||
//TODO: Properly handle manual gamma changes while in Replay
|
||||
|
||||
public static void setLighting(boolean lighting) {
|
||||
if(lighting) {
|
||||
if(!enabled) {
|
||||
@@ -35,4 +35,14 @@ public class LightingHandler {
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mc.gameSettings.gammaSetting = initialGamma;
|
||||
mc.gameSettings.saveOptions();
|
||||
}
|
||||
}, "lighting-handler-shutdown-hook"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package eu.crushedpixel.replaymod.utils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class TooltipRenderer extends Gui {
|
||||
|
||||
@@ -17,8 +18,9 @@ public class TooltipRenderer extends Gui {
|
||||
|
||||
int screenWidth, screenHeight;
|
||||
if(parent == null) {
|
||||
screenWidth = mc.displayWidth;
|
||||
screenHeight = mc.displayHeight;
|
||||
Point screenDimensions = MouseUtils.getScaledDimensions();
|
||||
screenWidth = screenDimensions.getX();
|
||||
screenHeight = screenDimensions.getY();
|
||||
} else {
|
||||
screenWidth = parent.width;
|
||||
screenHeight = parent.height;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.2 KiB |
Reference in New Issue
Block a user