Search in sources :

Example 1 with KeystrokesSettings

use of cc.hyperium.mods.keystrokes.config.KeystrokesSettings in project Hyperium by HyperiumClient.

the class KeystrokesMod method init.

/**
 * Init method, loads configs and events for the KeystrokesMod
 *
 * @return this mods instance
 */
@Override
public AbstractMod init() {
    config = new KeystrokesSettings(this, Hyperium.folder);
    config.load();
    new Sk1erMod("keystrokesmod", VERSION).checkStatus();
    renderer = new KeystrokesRenderer(this);
    EventBus.INSTANCE.register(renderer);
    Hyperium.INSTANCE.getHandlers().getHyperiumCommandHandler().registerCommand(new CommandKeystrokes(this));
    return this;
}
Also used : KeystrokesSettings(cc.hyperium.mods.keystrokes.config.KeystrokesSettings) Sk1erMod(cc.hyperium.mods.sk1ercommon.Sk1erMod) KeystrokesRenderer(cc.hyperium.mods.keystrokes.render.KeystrokesRenderer)

Example 2 with KeystrokesSettings

use of cc.hyperium.mods.keystrokes.config.KeystrokesSettings in project Hyperium by HyperiumClient.

the class GuiScreenKeystrokes method initGui.

@Override
public void initGui() {
    buttonList.clear();
    KeystrokesSettings settings = mod.getSettings();
    buttonList.add(buttonEnabled = new GuiButton(0, width / 2 - 155, calculateHeight(-1), 150, 20, "Keystrokes: " + (settings.isEnabled() ? "On" : "Off")));
    buttonList.add(buttonShowMouseButtons = new GuiButton(1, width / 2 + 5, calculateHeight(-1), 150, 20, "Show mouse buttons: " + (settings.isShowingMouseButtons() ? "On" : "Off")));
    buttonList.add(buttonShowSpacebar = new GuiButton(2, width / 2 - 155, calculateHeight(0), 150, 20, "Show spacebar: " + (settings.isShowingSpacebar() ? "On" : "Off")));
    buttonList.add(buttonShowCPS = new GuiButton(3, width / 2 + 5, calculateHeight(0), 150, 20, "Show CPS counter: " + (settings.isShowingCPS() ? "On" : "Off")));
    buttonList.add(buttonShowCPSOnButton = new GuiButton(4, width / 2 - 155, calculateHeight(1), 150, 20, "Show CPS on buttons: " + (settings.isShowingCPSOnButtons() ? "On" : "Off")));
    buttonList.add(buttonToggleChroma = new GuiButton(5, width / 2 + 5, calculateHeight(1), 150, 20, "Chroma: " + (settings.isChroma() ? "On" : "Off")));
    buttonList.add(buttonRightClick = new GuiButton(6, width / 2 - 155, calculateHeight(2), 150, 20, "Click Counter: " + (settings.isLeftClick() ? "Left" : "Right")));
    buttonList.add(buttonSneak = new GuiButton(7, width / 2 + 5, calculateHeight(2), 150, 20, "Show sneak: " + (settings.isShowingSneak() ? "On" : "Off")));
    buttonList.add(buttonFPS = new GuiButton(8, width / 2 - 155, calculateHeight(3), 150, 20, "Show FPS: " + (settings.isShowingFPS() ? "On" : "Off")));
    buttonList.add(buttonKeyBackground = new GuiButton(9, width / 2 + 5, calculateHeight(3), 150, 20, "Key background: " + (settings.isKeyBackgroundEnabled() ? "On" : "Off")));
    buttonList.add(buttonColors = new GuiButton(10, width / 2 - 155, calculateHeight(4), 150, 20, "Edit key colors"));
    buttonList.add(new GuiButton(11, width / 2 + 5, calculateHeight(4), 150, 20, "Edit key background colors"));
    buttonList.add(new GuiSliderScale(mod, 12, width / 2 - 155, calculateHeight(5), 150, 20, this));
    buttonList.add(new GuiSliderFadeTime(mod, 13, width / 2 + 5, calculateHeight(5), 150, 20, this));
    buttonList.add(buttonShowWASD = new GuiButton(14, width / 2 - 155, calculateHeight(6), 150, 20, "Show WASD: " + (settings.isShowingWASD() ? "On" : "Off")));
    buttonList.add(new GuiSliderOpacity(mod, 15, width / 2 + 5, calculateHeight(6), 150, 20, this));
    buttonList.add(new GuiButton(16, width / 2 - 155, calculateHeight(7), 150, 20, "Edit Custom Keys"));
    buttonList.add(buttonLiteralKeys = new GuiButton(17, width / 2 + 5, calculateHeight(7), 150, 20, "Literal Keys: " + (settings.isUsingLiteralKeys() ? "On" : "Off")));
    buttonList.add(buttonArrowKeys = new GuiButton(18, width / 2 - 155, calculateHeight(8), 150, 20, "Arrow Keys: " + (settings.isUsingArrowKeys() ? "On" : "Off")));
}
Also used : KeystrokesSettings(cc.hyperium.mods.keystrokes.config.KeystrokesSettings) GuiSliderFadeTime(cc.hyperium.mods.keystrokes.screen.impl.GuiSliderFadeTime) GuiButton(net.minecraft.client.gui.GuiButton) GuiSliderScale(cc.hyperium.mods.keystrokes.screen.impl.GuiSliderScale) GuiSliderOpacity(cc.hyperium.mods.keystrokes.screen.impl.GuiSliderOpacity)

Example 3 with KeystrokesSettings

use of cc.hyperium.mods.keystrokes.config.KeystrokesSettings in project Hyperium by HyperiumClient.

the class GuiScreenKeystrokes method mouseClicked.

@Override
protected void mouseClicked(int mouseX, int mouseY, int button) {
    try {
        super.mouseClicked(mouseX, mouseY, button);
    } catch (IOException ignored) {
    }
    if (button == 0) {
        KeystrokesSettings settings = mod.getSettings();
        if (!settings.isEnabled())
            return;
        int x = settings.getRenderX();
        int y = settings.getRenderY();
        int startX = (int) ((x - 4) * settings.getScale());
        int startY = (int) ((y - 4) * settings.getScale());
        int endX = (int) (startX + ((settings.getWidth() * settings.getScale())));
        int endY = (int) (startY + (settings.getHeight() * settings.getScale()));
        if (mouseX >= startX && mouseX <= endX && mouseY >= startY && mouseY <= endY) {
            dragging = true;
            lastMouseX = mouseX;
            lastMouseY = mouseY;
        }
    }
}
Also used : KeystrokesSettings(cc.hyperium.mods.keystrokes.config.KeystrokesSettings) IOException(java.io.IOException)

Example 4 with KeystrokesSettings

use of cc.hyperium.mods.keystrokes.config.KeystrokesSettings in project Hyperium by HyperiumClient.

the class GuiScreenKeystrokes method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    KeystrokesSettings settings = mod.getSettings();
    switch(button.id) {
        case 0:
            settings.setEnabled(!settings.isEnabled());
            buttonEnabled.displayString = "Keystrokes: " + (settings.isEnabled() ? "On" : "Off");
            updated = true;
            break;
        case 1:
            settings.setShowingMouseButtons(!settings.isShowingMouseButtons());
            buttonShowMouseButtons.displayString = "Show mouse buttons: " + (settings.isShowingMouseButtons() ? "On" : "Off");
            updated = true;
            break;
        case 2:
            settings.setShowingSpacebar(!settings.isShowingSpacebar());
            buttonShowSpacebar.displayString = "Show spacebar: " + (settings.isShowingSpacebar() ? "On" : "Off");
            updated = true;
            break;
        case 3:
            settings.setShowingCPS(!settings.isShowingCPS());
            buttonShowCPS.displayString = "Show CPS counter: " + (settings.isShowingCPS() ? "On" : "Off");
            updated = true;
            break;
        case 4:
            settings.setShowingCPSOnButtons(!settings.isShowingCPSOnButtons());
            buttonShowCPSOnButton.displayString = "Show CPS on buttons: " + (settings.isShowingCPSOnButtons() ? "On" : "Off");
            updated = true;
            break;
        case 5:
            settings.setChroma(!settings.isChroma());
            buttonToggleChroma.displayString = "Chroma: " + (settings.isChroma() ? "On" : "Off");
            updated = true;
            break;
        case 6:
            settings.setLeftClick(!settings.isLeftClick());
            buttonRightClick.displayString = "Click Counter: " + (settings.isLeftClick() ? "Left" : "Right");
            updated = true;
            break;
        case 7:
            settings.setShowingSneak(!settings.isShowingSneak());
            buttonSneak.displayString = "Show sneak: " + (settings.isShowingSneak() ? "On" : "Off");
            updated = true;
            break;
        case 8:
            settings.setShowingFPS(!settings.isShowingFPS());
            buttonFPS.displayString = "Show FPS: " + (settings.isShowingFPS() ? "On" : "Off");
            updated = true;
            break;
        case 9:
            settings.setKeyBackgroundEnabled(!settings.isKeyBackgroundEnabled());
            buttonKeyBackground.displayString = "Key background: " + (settings.isKeyBackgroundEnabled() ? "On" : "Off");
            updated = true;
            break;
        case 10:
            mc.displayGuiScreen(new GuiScreenColor(mod, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getRed();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setRed(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getGreen();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setGreen(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getBlue();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setBlue(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getPressedRed();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setPressedRed(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getPressedGreen();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setPressedGreen(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getPressedBlue();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setPressedBlue(intAmount);
                    updated = true;
                }
            }));
            break;
        case 11:
            mc.displayGuiScreen(new GuiScreenBackgroundColor(mod, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getKeyBackgroundRed();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setKeyBackgroundRed(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getKeyBackgroundGreen();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setKeyBackgroundGreen(intAmount);
                    updated = true;
                }
            }, new IScrollable() {

                @Override
                public double getAmount() {
                    return settings.getKeyBackgroundBlue();
                }

                @Override
                public void onScroll(double doubleAmount, int intAmount) {
                    settings.setKeyBackgroundBlue(intAmount);
                    updated = true;
                }
            }));
            break;
        case 14:
            settings.setShowingWASD(!settings.isShowingWASD());
            buttonShowWASD.displayString = "Show WASD: " + (settings.isShowingWASD() ? "On" : "Off");
            updated = true;
            break;
        case 16:
            mc.displayGuiScreen(new GuiScreenEditKeys(mod));
            break;
        case 17:
            settings.setUsingLiteralKeys(!settings.isUsingLiteralKeys());
            buttonLiteralKeys.displayString = "Literal Keys: " + (settings.isUsingLiteralKeys() ? "On" : "Off");
            updated = true;
            break;
        case 18:
            settings.setUsingArrowKeys(!settings.isUsingArrowKeys());
            buttonArrowKeys.displayString = "Arrow Keys: " + (settings.isUsingArrowKeys() ? "On" : "Off");
            updated = true;
            break;
    }
}
Also used : KeystrokesSettings(cc.hyperium.mods.keystrokes.config.KeystrokesSettings)

Example 5 with KeystrokesSettings

use of cc.hyperium.mods.keystrokes.config.KeystrokesSettings in project Hyperium by HyperiumClient.

the class GuiScreenKeystrokes method mouseClickMove.

@Override
protected void mouseClickMove(int mouseX, int mouseY, int lastButtonClicked, long timeSinceMouseClick) {
    if (dragging) {
        KeystrokesSettings settings = mod.getSettings();
        settings.setX((int) (settings.getRenderX() + (mouseX - lastMouseX) / settings.getScale()));
        settings.setY((int) (settings.getRenderY() + (mouseY - lastMouseY) / settings.getScale()));
        lastMouseX = mouseX;
        lastMouseY = mouseY;
        updated = true;
    }
}
Also used : KeystrokesSettings(cc.hyperium.mods.keystrokes.config.KeystrokesSettings)

Aggregations

KeystrokesSettings (cc.hyperium.mods.keystrokes.config.KeystrokesSettings)6 KeystrokesRenderer (cc.hyperium.mods.keystrokes.render.KeystrokesRenderer)1 GuiSliderFadeTime (cc.hyperium.mods.keystrokes.screen.impl.GuiSliderFadeTime)1 GuiSliderOpacity (cc.hyperium.mods.keystrokes.screen.impl.GuiSliderOpacity)1 GuiSliderScale (cc.hyperium.mods.keystrokes.screen.impl.GuiSliderScale)1 Sk1erMod (cc.hyperium.mods.sk1ercommon.Sk1erMod)1 IOException (java.io.IOException)1 GuiButton (net.minecraft.client.gui.GuiButton)1