Search in sources :

Example 6 with WButton

use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.

the class DefaultSettingsWidgetFactory method selectW.

// Other
private void selectW(WContainer c, Setting<?> setting, Runnable action) {
    WButton button = c.add(theme.button("Select")).expandCellX().widget();
    button.action = action;
    reset(c, setting, null);
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton)

Example 7 with WButton

use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.

the class DefaultSettingsWidgetFactory method reset.

private void reset(WContainer c, Setting<?> setting, Runnable action) {
    WButton reset = c.add(theme.button(GuiRenderer.RESET)).widget();
    reset.action = () -> {
        setting.reset();
        if (action != null)
            action.run();
    };
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton)

Example 8 with WButton

use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.

the class HeadScreen method loadHeads.

private void loadHeads() {
    MatHaxExecutor.execute(() -> {
        List<Map<String, String>> res = HTTP.get("https://minecraft-heads.com/scripts/api.php?cat=" + getCategory()).sendJson(gsonType);
        List<ItemStack> heads = new ArrayList<>();
        res.forEach(a -> {
            try {
                heads.add(createHeadStack(a.get("uuid"), a.get("value"), a.get("name")));
            } catch (Exception ignored) {
            }
        });
        WTable t = theme.table();
        for (ItemStack head : heads) {
            t.add(theme.item(head));
            t.add(theme.label(head.getName().asString()));
            WButton give = t.add(theme.button("Give")).widget();
            give.action = () -> {
                try {
                    GiveUtils.giveItem(head);
                } catch (CommandSyntaxException e) {
                    ChatUtils.error("Heads", e.getMessage());
                }
            };
            WButton equip = t.add(theme.button("Equip")).widget();
            equip.tooltip = "Equip client-side.";
            equip.action = () -> mc.player.getInventory().armor.set(3, head);
            t.row();
        }
        set();
        add(t).expandX().minWidth(400).widget();
    });
}
Also used : WTable(mathax.client.gui.widgets.containers.WTable) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack) WButton(mathax.client.gui.widgets.pressable.WButton) Map(java.util.Map) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException) CommandSyntaxException(com.mojang.brigadier.exceptions.CommandSyntaxException)

Example 9 with WButton

use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.

the class CapesModule method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    WHorizontalList w = theme.horizontalList();
    WButton reload = w.add(theme.button("Reload")).widget();
    reload.action = () -> {
        if (isActive())
            Capes.init();
    };
    w.add(theme.label("Reloads the capes."));
    return w;
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Example 10 with WButton

use of mathax.client.gui.widgets.pressable.WButton in project Client by MatHax.

the class FakePlayer method getWidget.

// Buttons
@Override
public WWidget getWidget(GuiTheme theme) {
    WHorizontalList w = theme.horizontalList();
    WButton spawn = w.add(theme.button("Spawn")).widget();
    spawn.action = () -> {
        if (isActive())
            FakePlayerManager.add(name.get(), health.get(), copyInv.get());
    };
    WButton clear = w.add(theme.button("Clear")).widget();
    clear.action = () -> {
        if (isActive())
            FakePlayerManager.clear();
    };
    return w;
}
Also used : WButton(mathax.client.gui.widgets.pressable.WButton) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Aggregations

WButton (mathax.client.gui.widgets.pressable.WButton)29 WHorizontalList (mathax.client.gui.widgets.containers.WHorizontalList)9 WTable (mathax.client.gui.widgets.containers.WTable)4 WMinus (mathax.client.gui.widgets.pressable.WMinus)4 WLabel (mathax.client.gui.widgets.WLabel)3 WCheckbox (mathax.client.gui.widgets.pressable.WCheckbox)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 WItemWithLabel (mathax.client.gui.widgets.WItemWithLabel)2 Block (net.minecraft.block.Block)2 NbtString (net.minecraft.nbt.NbtString)2 CommandSyntaxException (com.mojang.brigadier.exceptions.CommandSyntaxException)1 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 Map (java.util.Map)1 PlaylistsScreen (mathax.client.gui.screens.music.PlaylistsScreen)1 WVerticalList (mathax.client.gui.widgets.containers.WVerticalList)1 WTextBox (mathax.client.gui.widgets.input.WTextBox)1 WPlus (mathax.client.gui.widgets.pressable.WPlus)1