Search in sources :

Example 1 with WSection

use of mathax.client.gui.widgets.containers.WSection in project Client by MatHax.

the class ModuleScreen method initWidgets.

@Override
public void initWidgets() {
    // Description
    add(theme.label(module.description, Utils.getWindowWidth() / 2.0));
    // Settings
    if (module.settings.groups.size() > 0) {
        settingsContainer = add(theme.verticalList()).expandX().widget();
        settingsContainer.add(theme.settings(module.settings)).expandX();
    }
    // Custom widget
    WWidget widget = module.getWidget(theme);
    if (widget != null) {
        add(theme.horizontalSeparator()).expandX();
        Cell<WWidget> cell = add(widget);
        if (widget instanceof WContainer)
            cell.expandX();
    }
    // Bind
    WSection section = add(theme.section("Bind", true)).expandX().widget();
    keybind = section.add(theme.keybind(module.keybind)).expandX().widget();
    keybind.actionOnSet = () -> Modules.get().setModuleToBind(module);
    // Toggle on bind release
    WHorizontalList tobr = section.add(theme.horizontalList()).widget();
    tobr.add(theme.label("Toggle on bind release: "));
    WCheckbox tobrC = tobr.add(theme.checkbox(module.toggleOnBindRelease)).widget();
    tobrC.action = () -> module.toggleOnBindRelease = tobrC.checked;
    // Module
    add(theme.section("Module", true)).expandX().widget();
    // Bottom
    WHorizontalList bottom = add(theme.horizontalList()).expandX().widget();
    // Messages
    bottom.add(theme.label("Toggle message: "));
    WCheckbox messageToggle = bottom.add(theme.checkbox(module.isMessageEnabled())).expandCellX().widget();
    messageToggle.action = () -> {
        if (module.isMessageEnabled() != messageToggle.checked)
            module.setToggleMessage(messageToggle.checked);
    };
    // Toasts
    bottom.add(theme.label("Toggle toast: "));
    WCheckbox toastToggle = bottom.add(theme.checkbox(module.isToastEnabled())).widget();
    toastToggle.action = () -> {
        if (module.isToastEnabled() != toastToggle.checked)
            module.setToggleToast(toastToggle.checked);
    };
    // Bottom 2
    WHorizontalList bottom2 = add(theme.horizontalList()).expandX().widget();
    // Active
    bottom2.add(theme.label("Active: "));
    WCheckbox active = bottom2.add(theme.checkbox(module.isActive())).expandCellX().widget();
    active.action = () -> {
        if (module.isActive() != active.checked)
            module.toggle();
    };
    // Visible
    bottom2.add(theme.label("Visible: "));
    WCheckbox visible = bottom2.add(theme.checkbox(module.isVisible())).widget();
    visible.action = () -> {
        if (module.isVisible() != visible.checked)
            module.setVisible(visible.checked);
    };
}
Also used : WSection(mathax.client.gui.widgets.containers.WSection) WWidget(mathax.client.gui.widgets.WWidget) WContainer(mathax.client.gui.widgets.containers.WContainer) WCheckbox(mathax.client.gui.widgets.pressable.WCheckbox) WHorizontalList(mathax.client.gui.widgets.containers.WHorizontalList)

Example 2 with WSection

use of mathax.client.gui.widgets.containers.WSection in project Client by MatHax.

the class ModulesScreen method createSearchW.

// Search
protected void createSearchW(WContainer w, String text) {
    if (!text.isEmpty()) {
        // Titles
        Set<Module> modules = Modules.get().searchTitles(text);
        if (modules.size() > 0) {
            WSection section = w.add(theme.section("Modules")).expandX().widget();
            section.spacing = 0;
            for (Module module : modules) {
                section.add(theme.module(module)).expandX();
            }
        }
        // Settings
        modules = Modules.get().searchSettingTitles(text);
        if (modules.size() > 0) {
            WSection section = w.add(theme.section("Settings")).expandX().widget();
            section.spacing = 0;
            for (Module module : modules) {
                section.add(theme.module(module)).expandX();
            }
        }
    }
}
Also used : WSection(mathax.client.gui.widgets.containers.WSection) Module(mathax.client.systems.modules.Module)

Example 3 with WSection

use of mathax.client.gui.widgets.containers.WSection in project Client by MatHax.

the class StatsScreen method updateData.

private void updateData() {
    clear();
    GuiTheme theme = GuiThemes.get();
    Language lang = TranslationStorage.getInstance();
    add(theme.label(String.format("Type: %s", lang.get(entity.getType().getTranslationKey()))));
    add(theme.label(String.format("Age: %d", entity.age)));
    add(theme.label(String.format("UUID: %s", entity.getUuidAsString())));
    if (entity instanceof LivingEntity) {
        LivingEntity liv = (LivingEntity) entity;
        add(theme.label(String.format("Health: %.2f/%.2f", liv.getHealth(), liv.getMaxHealth())));
        add(theme.label(String.format("Armor: %d/20", liv.getArmor())));
        WSection effectList = add(theme.section("Status Effects", effectListExpanded)).expandX().widget();
        effectList.action = () -> effectListExpanded = effectList.isExpanded();
        liv.getActiveStatusEffects().forEach((effect, instance) -> {
            String status = lang.get(effect.getTranslationKey());
            if (instance.getAmplifier() != 0)
                status += (String.format(" %d (%s)", instance.getAmplifier() + 1, StatusEffectUtil.durationToString(instance, 1)));
            else
                status += (String.format(" (%s)", StatusEffectUtil.durationToString(instance, 1)));
            effectList.add(theme.label(status)).expandX();
        });
        if (liv.getActiveStatusEffects().isEmpty())
            effectList.add(theme.label("No effects")).expandX();
        WSection attribList = add(theme.section("Attributes", attribListExpanded)).expandX().widget();
        attribList.action = () -> attribListExpanded = attribList.isExpanded();
        liv.getAttributes().getTracked().forEach((attrib) -> attribList.add(theme.label(String.format("%s: %.2f", lang.get(attrib.getAttribute().getTranslationKey()), attrib.getValue()))).expandX());
    }
    WSection dimension = add(theme.section("Dimensions", dimensionExpanded)).expandX().widget();
    dimension.action = () -> dimensionExpanded = dimension.isExpanded();
    dimension.add(theme.label(String.format("Position: %.2f, %.2f, %.2f", entity.getX(), entity.getY(), entity.getZ()))).expandX();
    dimension.add(theme.label(String.format("Yaw: %.2f, Pitch: %.2f", entity.getYaw(), entity.getPitch()))).expandX();
    Box box = entity.getBoundingBox();
    dimension.add(theme.label(String.format("Bounding Box: %.2f, %.2f, %.2f", box.maxX - box.minX, box.maxY - box.minY, box.maxZ - box.minZ))).expandX();
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) WSection(mathax.client.gui.widgets.containers.WSection) Language(net.minecraft.util.Language) GuiTheme(mathax.client.gui.GuiTheme) Box(net.minecraft.util.math.Box)

Aggregations

WSection (mathax.client.gui.widgets.containers.WSection)3 GuiTheme (mathax.client.gui.GuiTheme)1 WWidget (mathax.client.gui.widgets.WWidget)1 WContainer (mathax.client.gui.widgets.containers.WContainer)1 WHorizontalList (mathax.client.gui.widgets.containers.WHorizontalList)1 WCheckbox (mathax.client.gui.widgets.pressable.WCheckbox)1 Module (mathax.client.systems.modules.Module)1 LivingEntity (net.minecraft.entity.LivingEntity)1 Language (net.minecraft.util.Language)1 Box (net.minecraft.util.math.Box)1