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);
}
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();
};
}
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();
});
}
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;
}
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;
}
Aggregations