package me.rambolo.mist.gui.death; import java.awt.Font; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL13; import static org.lwjgl.opengl.GL11.*; import me.rambolo.mist.Mist; import me.rambolo.mist.font.MistFont; import me.rambolo.mist.font.NahrFont; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiYesNo; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.resources.I18n; import static me.rambolo.mist.util.usefulshit.MistUtils.*; public class GuiDeathScreen extends GuiScreen{ private static MistFont font, resp; private long delay = (1000L / 6); private int widthSize = 0; private static boolean keyStates[] = new boolean[256]; public GuiDeathScreen() { updateText(); } public void updateText() { font = new MistFont(new Font("Pricedown Bl", Font.PLAIN, 26)); resp = new MistFont(new Font("Arial", Font.PLAIN, 16)); } public boolean checkKey(int i) { if(mc.currentScreen != null) return false; if(Keyboard.isKeyDown(i) != keyStates[i]) return keyStates[i] = !keyStates[i]; else return false; } public void handleKeyboardInput() { if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && mc.thePlayer.isDead) { GuiYesNo var2 = new GuiYesNo(this, I18n.format("deathScreen.quit.confirm", new Object[0]), "", I18n.format("deathScreen.titleScreen", new Object[0]), I18n.format("deathScreen.respawn", new Object[0]), 0); this.mc.displayGuiScreen(var2); var2.func_146350_a(5); } if(Keyboard.getEventKey() == Keyboard.KEY_RETURN && mc.thePlayer.isDead) { mc.displayGuiScreen((GuiScreen)null); mc.thePlayer.respawnPlayer(); } } public void confirmClicked(boolean par1, int par2) { if (par1) { this.mc.theWorld.sendQuittingDisconnectingPacket(); this.mc.loadWorld((WorldClient)null); this.mc.displayGuiScreen(new GuiMainMenu()); } else { this.mc.thePlayer.respawnPlayer(); this.mc.displayGuiScreen((GuiScreen)null); } } public void drawScreen(int i, int j, float f) { ScaledResolution res = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); width = res.getScaledWidth(); height = res.getScaledHeight(); drawRect(0, 0, width, height, 0x80000000); drawGradientRectSlant(0, height / 2 - 25, width, height / 2 + 25, 0x80000000, 0x80000000); double speed; speed = 7; delay = (long)(1000L / speed); Mist.getTimeManager().updateTimer(); if(Mist.getTimeManager().sleep(delay)) { widthSize += 1; Mist.getTimeManager().updateLast(); } if(widthSize == 81) { mc.thePlayer.respawnPlayer(); mc.displayGuiScreen((GuiScreen)null); widthSize = 0; } drawGradientRectRIGHT(width - 214 - 5, height - 48 - 12, width - 30 - 20, height - 30 - 14, 0x00000000, 0xAF000000); drawRect(width - 125 + widthSize - 10, height - 42 - 12, width - 35 - 20, height - 36 - 14, 0xAFAA2222); drawRect(width - 125 - 10, height - 42 - 12, width - 125 + widthSize - 10, height - 36 - 14, 0xAFFF2222); drawRect(width - 194, height - 40, width - 50, height - 25, 0xAF000000); if(mc.thePlayer.isDead) { Mist.nfont_dc_other.drawString("Respawn (\247aEnter\247f)", width - 15 - font.getStringWidth("Respawn (Enter)") , height - 35, NahrFont.FontType.PLAIN, 0xFFFFFFFF, 0); Mist.nfont_dc_other.drawString("Quit (\247cESC\247f)", width - 135 - font.getStringWidth("Quit (ESC)"), height - 35, NahrFont.FontType.PLAIN, 0xFFFFFFFF, 0); }else{ Mist.nfont_dc_other.drawString("Respawn (\247aEnter\247f)", width - 15 - font.getStringWidth("Respawn (Enter)") , height - 35, NahrFont.FontType.PLAIN, 0xAFAAAAAA, 0); Mist.nfont_dc_other.drawString("Quit (\247cESC\247f)", width - 135 - font.getStringWidth("Quit (ESC)"), height - 35, NahrFont.FontType.PLAIN, 0xAFAAAAAA, 0); } Mist.nfont_dc_wasted.drawString("wasted", width / 2 - font.getStringWidth("wasted") - 60 / 2, height / 2 - font.getStringHeight("wasted") / 2 - 5, NahrFont.FontType.PLAIN, 0xFFFFFFFF, 0x00000000); //Mist.nfont_dc_score.drawString("", width / 2 - font.getStringWidth("") / 2, height / 2 - font.getStringHeight("") / 2 + 20, NahrFont.FontType.PLAIN, 0xFFFFFFFF, 0); Mist.nfont_dc_other.drawString("RESPAWNING", width - font.getStringWidth("RESPAWNING") / 2 - 150 - 8, height - font.getStringHeight("RESPAWNING") / 2 - 48.5F, NahrFont.FontType.PLAIN, 0xFFFFFFFF, 0x00000000); super.drawScreen(i, j, f); } public boolean doesGuiPauseGame() { return false; } }