Search in sources :

Example 1 with Option

use of org.bleachhack.setting.option.Option in project BleachHack by BleachDrinker420.

the class BleachOptionsScreen method addCategory.

private int addCategory(int window, int x, int y, String name, Option<?>... entries) {
    getWindow(window).addWidget(new WindowTextWidget("- " + name + " -", true, WindowTextWidget.TextAlign.MIDDLE, x, y, 0xe0e0e0));
    y += 20;
    for (Option<?> entry : entries) {
        // Option
        getWindow(0).addWidget(entry.getWidget(x + 10, y - 3, 56, 16));
        // Revert button
        getWindow(window).addWidget(new WindowButtonWidget(x + 68, y - 3, x + 84, y + 13, "", entry::resetValue).withRenderEvent((w, ms, wx, wy) -> ((WindowButtonWidget) w).text = entry.isDefault() ? "\u00a77\u21c4" : "\u21c4"));
        // Name text (at the end because of... reasons)
        getWindow(window).addWidget(new WindowTextWidget(new LiteralText(entry.getName()).styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText(entry.getTooltip())))), true, x - 107, y, 0xffffff));
        y += 17;
    }
    return y;
}
Also used : WindowScreen(org.bleachhack.gui.window.WindowScreen) LiteralText(net.minecraft.text.LiteralText) MatrixStack(net.minecraft.client.util.math.MatrixStack) Items(net.minecraft.item.Items) WindowWidget(org.bleachhack.gui.window.widget.WindowWidget) WindowButtonWidget(org.bleachhack.gui.window.widget.WindowButtonWidget) HoverEvent(net.minecraft.text.HoverEvent) WindowTextWidget(org.bleachhack.gui.window.widget.WindowTextWidget) ItemStack(net.minecraft.item.ItemStack) Screen(net.minecraft.client.gui.screen.Screen) Window(org.bleachhack.gui.window.Window) WindowScrollbarWidget(org.bleachhack.gui.window.widget.WindowScrollbarWidget) Option(org.bleachhack.setting.option.Option) HoverEvent(net.minecraft.text.HoverEvent) WindowTextWidget(org.bleachhack.gui.window.widget.WindowTextWidget) WindowButtonWidget(org.bleachhack.gui.window.widget.WindowButtonWidget) LiteralText(net.minecraft.text.LiteralText)

Aggregations

Screen (net.minecraft.client.gui.screen.Screen)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 ItemStack (net.minecraft.item.ItemStack)1 Items (net.minecraft.item.Items)1 HoverEvent (net.minecraft.text.HoverEvent)1 LiteralText (net.minecraft.text.LiteralText)1 Window (org.bleachhack.gui.window.Window)1 WindowScreen (org.bleachhack.gui.window.WindowScreen)1 WindowButtonWidget (org.bleachhack.gui.window.widget.WindowButtonWidget)1 WindowScrollbarWidget (org.bleachhack.gui.window.widget.WindowScrollbarWidget)1 WindowTextWidget (org.bleachhack.gui.window.widget.WindowTextWidget)1 WindowWidget (org.bleachhack.gui.window.widget.WindowWidget)1 Option (org.bleachhack.setting.option.Option)1