public final void setCurrentScreen(GuiScreen newScreen) {
        if (currentScreen != null) {
            currentScreen.onClose();
        }
        HUDScreen.chatLocation = 0;

        // SURVIVAL: Game over
        if (newScreen == null && player.health <= 0) {
            newScreen = new GameOverScreen();
        }

        currentScreen = newScreen;
        if (newScreen != null) {
            if (hasMouse) {
                player.releaseAllKeys();
                hasMouse = false;
                if (isLevelLoaded) {
                    try {
                        Mouse.setNativeCursor(null);
                    } catch (LWJGLException ex) {
                        LogUtil.logError("Error showing the mouse cursor.", ex);
                    }
                } else {
                    Mouse.setGrabbed(false);
                }
            }

            int var2 = width * 240 / height;
            int var3 = height * 240 / height;
            newScreen.open(this, var2, var3);
            isConnecting = false;
            return;
        }
        grabMouse();
    }