Search in sources :

Example 1 with CustomKey

use of cc.hyperium.mods.keystrokes.keys.impl.CustomKey in project Hyperium by HyperiumClient.

the class KeystrokesSettings method parseSettings.

private void parseSettings(BetterJsonObject object) {
    x = object.optInt("x");
    y = object.optInt("y");
    red = object.optInt("red", 255);
    green = object.optInt("green", 255);
    blue = object.optInt("blue", 255);
    pressedRed = object.optInt("pressedRed");
    pressedGreen = object.optInt("pressedGreen");
    pressedBlue = object.optInt("pressedBlue");
    setScale(object.optDouble("scale", 1.0D));
    setFadeTime(object.optDouble("fadeTime", 1.0D));
    enabled = object.optBoolean("enabled", true);
    chroma = object.optBoolean("chroma");
    leftClick = object.optBoolean("leftClick", true);
    mouseButtons = object.optBoolean("mouseButtons");
    showCPS = object.optBoolean("showCPS");
    showCPSOnButtons = object.optBoolean("showCPSOnButtons");
    showSpacebar = object.optBoolean("showSpacebar");
    showingSneak = object.optBoolean("showSneak");
    showingFPS = object.optBoolean("showFps");
    keyBackground = object.optBoolean("keyBackground", true);
    showingWASD = object.optBoolean("showingWASD", true);
    literalKeys = object.optBoolean("literalKeys");
    keyBackgroundOpacity = object.optInt("keyBackgroundOpacity", 120);
    keyBackgroundRed = object.optInt("keyBackgroundRed");
    keyBackgroundGreen = object.optInt("keyBackgroundGreen");
    keyBackgroundBlue = object.optInt("keyBackgroundBlue");
    arrowKeys = object.optBoolean("arrowKeys");
    JsonObject data = object.getData();
    if (data.has("custom")) {
        JsonArray custom = data.getAsJsonArray("custom");
        for (JsonElement element : custom) {
            JsonHolder holder = new JsonHolder(element.getAsJsonObject());
            CustomKeyWrapper wrapper = new CustomKeyWrapper(new CustomKey(theMod, holder.optInt("key"), holder.optInt("type")), holder.optInt("xOffset"), holder.optInt("yOffset"));
            configWrappers.add(wrapper);
        }
    }
}
Also used : JsonArray(com.google.gson.JsonArray) JsonHolder(cc.hyperium.utils.JsonHolder) CustomKeyWrapper(cc.hyperium.mods.keystrokes.render.CustomKeyWrapper) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) BetterJsonObject(cc.hyperium.utils.BetterJsonObject) CustomKey(cc.hyperium.mods.keystrokes.keys.impl.CustomKey)

Example 2 with CustomKey

use of cc.hyperium.mods.keystrokes.keys.impl.CustomKey in project Hyperium by HyperiumClient.

the class GuiScreenEditKeys method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    switch(button.id) {
        case 1:
            CustomKeyWrapper key = new CustomKeyWrapper(new CustomKey(mod, 30, 1), 10, 10);
            selected = key;
            mod.getRenderer().getCustomKeys().add(key);
            break;
        case 2:
            listeningForNewKey = true;
            changeKey.displayString = "Listening...";
            break;
        case 3:
            CustomKey theKey = selected.getKey();
            theKey.setType(theKey.getType() + 1);
            if (theKey.getType() > 2) {
                theKey.setType(0);
                break;
            }
            break;
        case 4:
            mod.getRenderer().getCustomKeys().remove(selected);
            selected = null;
            break;
    }
}
Also used : CustomKeyWrapper(cc.hyperium.mods.keystrokes.render.CustomKeyWrapper) CustomKey(cc.hyperium.mods.keystrokes.keys.impl.CustomKey)

Aggregations

CustomKey (cc.hyperium.mods.keystrokes.keys.impl.CustomKey)2 CustomKeyWrapper (cc.hyperium.mods.keystrokes.render.CustomKeyWrapper)2 BetterJsonObject (cc.hyperium.utils.BetterJsonObject)1 JsonHolder (cc.hyperium.utils.JsonHolder)1 JsonArray (com.google.gson.JsonArray)1 JsonElement (com.google.gson.JsonElement)1 JsonObject (com.google.gson.JsonObject)1