mirror of https://github.com/kami-blue/client
fix being unable to close the gui sometimes and close #751
This commit is contained in:
parent
709b794804
commit
1bd7cd4eac
|
@ -16,6 +16,8 @@ import org.lwjgl.input.Mouse;
|
|||
import java.io.IOException;
|
||||
|
||||
import static me.zeroeightsix.kami.KamiMod.MODULE_MANAGER;
|
||||
import static me.zeroeightsix.kami.module.Module.closeSettings;
|
||||
import static me.zeroeightsix.kami.util.GuiFrameUtil.areSettingsOpen;
|
||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
||||
import static org.lwjgl.opengl.GL11.glEnable;
|
||||
|
||||
|
@ -97,7 +99,10 @@ public class DisplayGuiScreen extends GuiScreen {
|
|||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) throws IOException {
|
||||
if ((MODULE_MANAGER.getModule(ClickGUI.class).getBind().isDown(keyCode) || keyCode == Keyboard.KEY_ESCAPE) && !BindButton.waiting) {
|
||||
if (MODULE_MANAGER.getModule(ClickGUI.class).getBind().isDown(keyCode) || keyCode == Keyboard.KEY_ESCAPE) {
|
||||
if (areSettingsOpen()) {
|
||||
closeSettings();
|
||||
}
|
||||
mc.displayGuiScreen(lastScreen);
|
||||
} else {
|
||||
gui.handleKeyDown(keyCode);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class BindButton extends EnumButton {
|
|||
} else if (isAlt(key)) {
|
||||
alt = true;
|
||||
modes = new String[]{(ctrl ? "Ctrl+" : "") + "Alt+" + (shift ? "Shift+" : "")};
|
||||
} else if (key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE || key == Keyboard.KEY_ESCAPE) {
|
||||
} else if (key == Keyboard.KEY_BACK || key == Keyboard.KEY_DELETE) {
|
||||
m.getBind().setCtrl(false);
|
||||
m.getBind().setShift(false);
|
||||
m.getBind().setAlt(false);
|
||||
|
|
|
@ -2,6 +2,7 @@ package me.zeroeightsix.kami.util;
|
|||
|
||||
import me.zeroeightsix.kami.KamiMod;
|
||||
import me.zeroeightsix.kami.gui.kami.KamiGUI;
|
||||
import me.zeroeightsix.kami.gui.kami.component.SettingsPanel;
|
||||
import me.zeroeightsix.kami.gui.rgui.component.container.use.Frame;
|
||||
import me.zeroeightsix.kami.gui.rgui.util.ContainerHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -55,4 +56,14 @@ public class GuiFrameUtil {
|
|||
if (frame.getY() < 0) frame.setY(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean areSettingsOpen() {
|
||||
List<SettingsPanel> panels = ContainerHelper.getAllChildren(SettingsPanel.class, KamiMod.getInstance().getGuiManager());
|
||||
for (SettingsPanel settingsPanel : panels) {
|
||||
if (settingsPanel.isVisible()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue