Add indicator for full brightness

This commit is contained in:
johni0702
2015-10-09 16:04:20 +02:00
parent fefcdb1885
commit a074ed115c

View File

@@ -1,13 +1,26 @@
package com.replaymod.extras;
import com.replaymod.core.ReplayMod;
import com.replaymod.replay.ReplayHandler;
import com.replaymod.replay.ReplayModReplay;
import com.replaymod.replay.events.ReplayOpenEvent;
import com.replaymod.replay.gui.overlay.GuiReplayOverlay;
import de.johni0702.minecraft.gui.element.GuiImage;
import de.johni0702.minecraft.gui.element.IGuiImage;
import de.johni0702.minecraft.gui.layout.HorizontalLayout;
import net.minecraft.client.settings.GameSettings;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.lwjgl.input.Keyboard;
public class FullBrightness implements Extra {
@Mod.Instance(ReplayModReplay.MOD_ID)
private static ReplayModReplay module;
private final IGuiImage indicator = new GuiImage().setTexture(ReplayMod.TEXTURE, 90, 20, 19, 13).setSize(19, 13);
private GameSettings gameSettings;
private boolean active;
private float originalGamma;
@@ -21,6 +34,10 @@ public class FullBrightness implements Extra {
public void run() {
active = !active;
mod.getMinecraft().entityRenderer.lightmapUpdateNeeded = true;
ReplayHandler replayHandler = module.getReplayHandler();
if (replayHandler != null) {
updateIndicator(replayHandler.getOverlay());
}
}
});
@@ -38,4 +55,17 @@ public class FullBrightness implements Extra {
}
}
}
@SubscribeEvent
public void replayOpened(ReplayOpenEvent.Post event) {
updateIndicator(event.getReplayHandler().getOverlay());
}
private void updateIndicator(GuiReplayOverlay overlay) {
if (active) {
overlay.statusIndicatorPanel.addElements(new HorizontalLayout.Data(1), indicator);
} else {
overlay.statusIndicatorPanel.removeElement(indicator);
}
}
}