use of mathax.client.gui.widgets.containers.WTable 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.containers.WTable in project Client by MatHax.
the class AddAlteningAccountScreen method initWidgets.
@Override
public void initWidgets() {
WTable t = add(theme.table()).widget();
// Token
t.add(theme.label("Token: "));
WTextBox token = t.add(theme.textBox("")).minWidth(400).expandX().widget();
token.setFocused(true);
t.row();
// Add
add = t.add(theme.button("Add")).expandX().widget();
add.action = () -> {
if (!token.get().isEmpty())
AccountsScreen.addAccount(this, parent, new TheAlteningAccount(token.get()));
};
enterAction = add.action;
}
use of mathax.client.gui.widgets.containers.WTable in project Client by MatHax.
the class AddCrackedAccountScreen method initWidgets.
@Override
public void initWidgets() {
WTable t = add(theme.table()).widget();
// Name
t.add(theme.label("Name: "));
WTextBox name = t.add(theme.textBox("", (text, c) -> c != ' ')).minWidth(400).expandX().widget();
name.setFocused(true);
t.row();
// Add
add = t.add(theme.button("Add")).expandX().widget();
add.action = () -> {
if (!name.get().isEmpty() && (name.get().length() < 17) && name.get().matches("^[a-zA-Z0-9_]+$")) {
CrackedAccount account = new CrackedAccount(name.get());
if (!(Accounts.get().exists(account)))
AccountsScreen.addAccount(this, parent, account);
}
};
enterAction = add.action;
}
use of mathax.client.gui.widgets.containers.WTable in project Client by MatHax.
the class ProxiesScreen method initWidgets.
@Override
public void initWidgets() {
// Proxies
WTable table = add(theme.table()).expandX().widget();
for (Proxy proxy : Proxies.get()) {
// Enabled
WCheckbox enabled = table.add(theme.checkbox(proxy.enabled)).widget();
checkboxes.add(enabled);
enabled.action = () -> {
boolean checked = enabled.checked;
Proxies.get().setEnabled(proxy, checked);
for (WCheckbox checkbox : checkboxes) checkbox.checked = false;
enabled.checked = checked;
};
// Name
WLabel name = table.add(theme.label(proxy.name)).widget();
name.color = theme.textColor();
// Type
WLabel type = table.add(theme.label("(" + proxy.type + ")")).widget();
type.color = theme.textSecondaryColor();
// IP + Port
WHorizontalList ipList = table.add(theme.horizontalList()).expandCellX().widget();
ipList.spacing = 0;
ipList.add(theme.label(proxy.address));
ipList.add(theme.label(":")).widget().color = theme.textSecondaryColor();
ipList.add(theme.label(Integer.toString(proxy.port)));
// Edit
WButton edit = table.add(theme.button(GuiRenderer.EDIT)).widget();
edit.action = () -> openEditProxyScreen(proxy);
// Remove
WMinus remove = table.add(theme.minus()).widget();
remove.action = () -> {
Proxies.get().remove(proxy);
reload();
};
table.row();
}
WHorizontalList l = add(theme.horizontalList()).expandX().widget();
// New
WButton newBtn = l.add(theme.button("New")).expandX().widget();
newBtn.action = () -> openEditProxyScreen(null);
// Import
PointerBuffer filters = BufferUtils.createPointerBuffer(1);
ByteBuffer txtFilter = MemoryUtil.memASCII("*.txt");
filters.put(txtFilter);
filters.rewind();
WButton importBtn = l.add(theme.button("Import")).expandX().widget();
importBtn.action = () -> {
String selectedFile = TinyFileDialogs.tinyfd_openFileDialog("Import Proxies", null, filters, null, false);
if (selectedFile != null) {
File file = new File(selectedFile);
mc.setScreen(new ProxiesImportScreen(theme, file));
}
};
}
use of mathax.client.gui.widgets.containers.WTable in project Client by MatHax.
the class ServerCleanUpScreen method initWidgets.
@Override
public void initWidgets() {
WTable table = add(new WTable()).widget();
table.add(theme.label("Servers to remove:"));
table.row();
table.add(theme.label("Unknown Hosts")).widget().tooltip = "";
table.add(removeUnknown).widget();
table.row();
table.add(theme.label("Outdated Servers"));
table.add(removeOutdated).widget();
table.row();
table.add(theme.label("Failed Ping"));
table.add(removeFailed).widget();
table.row();
table.add(theme.label("\"Server Finder\" Servers"));
table.add(removeFound).widget();
table.row();
table.add(theme.label("Everything")).widget().color = new Color(255, 0, 0);
table.add(removeAll).widget();
table.row();
table.add(theme.label("Rename all Servers"));
table.add(rename).widget();
table.row();
table.add(theme.button("Execute")).expandX().widget().action = this::cleanUp;
}
Aggregations