Search in sources :

Example 1 with WSection

use of meteordevelopment.meteorclient.gui.widgets.containers.WSection in project meteor-rejects by AntiCope.

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(meteordevelopment.meteorclient.gui.widgets.containers.WSection) Language(net.minecraft.util.Language) GuiTheme(meteordevelopment.meteorclient.gui.GuiTheme) Box(net.minecraft.util.math.Box)

Example 2 with WSection

use of meteordevelopment.meteorclient.gui.widgets.containers.WSection in project meteor-client by MeteorDevelopment.

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(meteordevelopment.meteorclient.gui.widgets.containers.WSection) Module(meteordevelopment.meteorclient.systems.modules.Module)

Example 3 with WSection

use of meteordevelopment.meteorclient.gui.widgets.containers.WSection in project meteor-client by MeteorDevelopment.

the class ModuleScreen method initWidgets.

@Override
public void initWidgets() {
    // Description
    add(theme.label(module.description, 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;
    // Chat feedback
    WHorizontalList cf = section.add(theme.horizontalList()).widget();
    cf.add(theme.label("Chat Feedback: "));
    WCheckbox cfC = cf.add(theme.checkbox(module.chatFeedback)).widget();
    cfC.action = () -> module.chatFeedback = cfC.checked;
    add(theme.horizontalSeparator()).expandX();
    // Bottom
    WHorizontalList bottom = add(theme.horizontalList()).expandX().widget();
    // Active
    bottom.add(theme.label("Active: "));
    WCheckbox active = bottom.add(theme.checkbox(module.isActive())).expandCellX().widget();
    active.action = () -> {
        if (module.isActive() != active.checked)
            module.toggle();
    };
}
Also used : WSection(meteordevelopment.meteorclient.gui.widgets.containers.WSection) WWidget(meteordevelopment.meteorclient.gui.widgets.WWidget) WContainer(meteordevelopment.meteorclient.gui.widgets.containers.WContainer) WCheckbox(meteordevelopment.meteorclient.gui.widgets.pressable.WCheckbox) WHorizontalList(meteordevelopment.meteorclient.gui.widgets.containers.WHorizontalList)

Aggregations

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