use of meteordevelopment.meteorclient.gui.widgets.containers.WTable in project meteor-rejects by AntiCope.
the class ChatBot method getWidget.
@Override
public WWidget getWidget(GuiTheme theme) {
WTable table = theme.table();
fillTable(theme, table);
return table;
}
use of meteordevelopment.meteorclient.gui.widgets.containers.WTable in project meteor-rejects by AntiCope.
the class HeadScreen method loadHeads.
private void loadHeads() {
MeteorExecutor.execute(() -> {
List<Map<String, String>> res = Http.get("https://minecraft-heads.com/scripts/api.php?cat=" + getCat()).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 e) {
}
});
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 meteordevelopment.meteorclient.gui.widgets.containers.WTable in project meteor-client by MeteorDevelopment.
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 meteordevelopment.meteorclient.gui.widgets.containers.WTable in project meteor-client by MeteorDevelopment.
the class LeftRightListSettingScreen method abc.
private WTable abc(Consumer<List<Pair<T, Integer>>> addValues, boolean isLeft, Consumer<T> buttonAction) {
// Create
Cell<WTable> cell = this.table.add(theme.table()).top();
WTable table = cell.widget();
Consumer<T> forEach = t -> {
if (!includeValue(t))
return;
table.add(getValueWidget(t));
WPressable button = table.add(isLeft ? theme.plus() : theme.minus()).expandCellX().right().widget();
button.action = () -> buttonAction.accept(t);
table.row();
};
// Sort
List<Pair<T, Integer>> values = new ArrayList<>();
addValues.accept(values);
if (!filterText.isEmpty())
values.sort(Comparator.comparingInt(value -> -value.getRight()));
for (Pair<T, Integer> pair : values) forEach.accept(pair.getLeft());
if (table.cells.size() > 0)
cell.expandX();
return table;
}
use of meteordevelopment.meteorclient.gui.widgets.containers.WTable in project meteor-client by MeteorDevelopment.
the class LeftRightListSettingScreen method initWidgets.
private void initWidgets(Registry<T> registry) {
// Left (all)
WTable left = abc(pairs -> registry.forEach(t -> {
if (skipValue(t) || collection.contains(t))
return;
int words = Utils.search(getValueName(t), filterText);
if (words > 0)
pairs.add(new Pair<>(t, words));
}), true, t -> {
addValue(registry, t);
T v = getAdditionalValue(t);
if (v != null)
addValue(registry, v);
});
if (left.cells.size() > 0)
table.add(theme.verticalSeparator()).expandWidgetY();
// Right (selected)
abc(pairs -> {
for (T value : collection) {
if (skipValue(value))
continue;
int words = Utils.search(getValueName(value), filterText);
if (words > 0)
pairs.add(new Pair<>(value, words));
}
}, false, t -> {
removeValue(registry, t);
T v = getAdditionalValue(t);
if (v != null)
removeValue(registry, v);
});
}
Aggregations