Search in sources :

Example 1 with WindowTextWidget

use of org.bleachhack.gui.window.widget.WindowTextWidget in project BleachHack by BleachDrinker420.

the class BleachCreditsScreen method init.

public void init() {
    super.init();
    addWindow(new Window(width / 8, height / 8, width - width / 8, height - height / 8, "Credits", new ItemStack(Items.DRAGON_HEAD)));
    int w = getWindow(0).x2 - getWindow(0).x1;
    int h = getWindow(0).y2 - getWindow(0).y1;
    getWindow(0).addWidget(new WindowTextWidget(BleachHack.watermark.getText(), true, WindowTextWidget.TextAlign.MIDDLE, 3f, w / 2, 22, 0xb0b0b0));
    getWindow(0).addWidget(new WindowTextWidget(BleachHack.VERSION, true, WindowTextWidget.TextAlign.MIDDLE, 1.5f, w / 2, 41, 0xffc050));
    getWindow(0).addWidget(new WindowTextWidget("- Main Developer -", true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 65, 0xe0e0e0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("Bleach").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/BleachDrinker420\n\n\u00a7eMain Developer!")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 80, 0x51eff5));
    getWindow(0).addWidget(new WindowTextWidget("- Contributors -", true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 100, 0xe0e0e0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("LasnikProgram").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/lasnikprogram\n\n\u00a7fMade first version of LogoutSpot, AirPlace, EntityMenu, HoleESP, AutoParkour and Search.")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 115, 0x00a0a0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("slcoolj").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/slcoolj\n\n\u00a7fMade Criticals, Speedmine OG mode and did the module system rewrite.")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 127, 0x00a0a0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("DevScyu").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/DevScyu\n\n\u00a7fMade first version of AutoTool, Trajectories, NoRender, AutoWalk, ElytraReplace, HandProgress and added Login manager encryption.")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 139, 0x00a0a0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("Bunt3rhund").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/Bunt3rhund\n\n\u00a7fMade first version of Zoom.")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 151, 0x00a0a0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("MorganAnkan").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/MorganAnkan\n\n\u00a7fMade the title screen text Rgb.")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 163, 0x00a0a0));
    getWindow(0).addWidget(new WindowTextWidget(new LiteralText("ThePapanoob").styled(s -> s.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new LiteralText("\u00a77https://github.com/thepapanoob\n\n\u00a7fAdded Projectiles mode in Killaura.")))), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 175, 0x00a0a0));
    getWindow(0).addWidget(new WindowTextWidget("- Donators/Boosters -", true, WindowTextWidget.TextAlign.MIDDLE, w / 2, 195, 0xe0e0e0));
    int y = 210;
    if (boosterList != null) {
        boostersLoaded = true;
        for (ImmutablePair<Boolean, String> i : boosterList) {
            getWindow(0).addWidget(new WindowTextWidget(getBoosterText(i), true, WindowTextWidget.TextAlign.MIDDLE, w / 2, y, 0));
            y += 12;
        }
    } else {
        getWindow(0).addWidget(new WindowTextWidget("\u00a77Loading..", true, WindowTextWidget.TextAlign.MIDDLE, w / 2, y, 0));
        y += 12;
    }
    for (WindowWidget widget : getWindow(0).getWidgets()) {
        if (!(widget instanceof WindowScrollbarWidget)) {
            widget.cullY = true;
        }
    }
    scrollbar = getWindow(0).addWidget(new WindowScrollbarWidget(w - 11, 12, y - 10, h - 13, 0));
}
Also used : Window(org.bleachhack.gui.window.Window) WindowScrollbarWidget(org.bleachhack.gui.window.widget.WindowScrollbarWidget) HoverEvent(net.minecraft.text.HoverEvent) WindowTextWidget(org.bleachhack.gui.window.widget.WindowTextWidget) ItemStack(net.minecraft.item.ItemStack) WindowWidget(org.bleachhack.gui.window.widget.WindowWidget) LiteralText(net.minecraft.text.LiteralText)

Example 2 with WindowTextWidget

use of org.bleachhack.gui.window.widget.WindowTextWidget 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)

Example 3 with WindowTextWidget

use of org.bleachhack.gui.window.widget.WindowTextWidget in project BleachHack by BleachDrinker420.

the class BleachTitleScreen method init.

@Override
public void init() {
    super.init();
    addWindow(new Window(width / 8, height / 8, width - width / 8, height - height / 8 + 2, "BleachHack", new ItemStack(Items.MUSIC_DISC_CAT)));
    int w = getWindow(0).x2 - getWindow(0).x1;
    int h = getWindow(0).y2 - getWindow(0).y1;
    int maxY = MathHelper.clamp(h / 4 + 119, 0, h - 22);
    getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, h / 4 + 38, w / 2 + 100, h / 4 + 58, I18n.translate("menu.singleplayer"), () -> client.setScreen(new SelectWorldScreen(client.currentScreen))));
    getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, h / 4 + 62, w / 2 + 100, h / 4 + 82, I18n.translate("menu.multiplayer"), () -> client.setScreen(new MultiplayerScreen(client.currentScreen))));
    getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, h / 4 + 86, w / 2 + 100, h / 4 + 106, I18n.translate("menu.online"), () -> client.setScreen(new RealmsMainScreen(this))));
    getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 124, h / 4 + 86, w / 2 - 104, h / 4 + 106, "MC", () -> {
        customTitleScreen = !customTitleScreen;
        BleachFileHelper.saveMiscSetting("customTitleScreen", new JsonPrimitive(false));
        client.setScreen(new TitleScreen(false));
    }));
    getWindow(0).addWidget(new WindowButtonWidget(w / 2 - 100, maxY, w / 2 - 2, maxY + 20, I18n.translate("menu.options"), () -> client.setScreen(new OptionsScreen(client.currentScreen, client.options))));
    getWindow(0).addWidget(new WindowButtonWidget(w / 2 + 2, maxY, w / 2 + 100, maxY + 20, I18n.translate("menu.quit"), () -> client.scheduleStop()));
    // Main Text
    getWindow(0).addWidget(new WindowTextWidget(LiteralText.EMPTY, true, WindowTextWidget.TextAlign.MIDDLE, 3f, w / 2, h / 4 - 25, 0).withRenderEvent((widget, ms, wx, wy) -> {
        MutableText bhText = new LiteralText("");
        int i = 0;
        for (char c : "BleachHack".toCharArray()) {
            int fi = i++;
            bhText.append(new LiteralText(String.valueOf(c)).styled(s -> s.withColor(TextColor.fromRgb(UI.getRainbowFromSettings(fi)))));
        }
        ((WindowTextWidget) widget).setText(bhText);
    }));
    // Version Text
    getWindow(0).addWidget(new WindowTextWidget(BleachHack.VERSION, true, WindowTextWidget.TextAlign.MIDDLE, 1.5f, w / 2, h / 4 - 6, 0xffc050));
    // Splash
    getWindow(0).addWidget(new WindowTextWidget(LiteralText.EMPTY, true, WindowTextWidget.TextAlign.MIDDLE, 2f, -20f, w / 2 + 80, h / 4 + 6, 0xffff00).withRenderEvent((widget, ms, wx, wy) -> {
        if (splash != null) {
            WindowTextWidget windgetText = (WindowTextWidget) widget;
            windgetText.setText(new LiteralText(splash));
            windgetText.color = (windgetText.color & 0x00ffffff) | ((splashTicks * 17) << 24);
            float scale = 1.8F - MathHelper.abs(MathHelper.sin(Util.getMeasuringTimeMs() % 1000L / 1000.0F * 6.2831855F) * 0.1F);
            scale = scale * 66.0F / (textRenderer.getWidth(splash) + 32);
            windgetText.setScale(scale);
        }
    }));
    // Update Text
    JsonObject updateJson = BleachHack.getUpdateJson();
    if (updateJson != null && updateJson.has("version") && updateJson.get("version").getAsInt() > BleachHack.INTVERSION) {
        getWindow(0).addWidget(new WindowTextWidget("\u00a76\u00a7nUpdate\u00a76", true, 4, h - 12, 0xffffff).withClickEvent((widget, mx, my, wx, wy) -> client.setScreen(new UpdateScreen(client.currentScreen, updateJson))));
    }
}
Also used : Window(org.bleachhack.gui.window.Window) FabricLoader(net.fabricmc.loader.api.FabricLoader) JsonObject(com.google.gson.JsonObject) LiteralText(net.minecraft.text.LiteralText) SelectWorldScreen(net.minecraft.client.gui.screen.world.SelectWorldScreen) BodyHandlers(java.net.http.HttpResponse.BodyHandlers) Util(net.minecraft.util.Util) TranslatableText(net.minecraft.text.TranslatableText) BleachFileHelper(org.bleachhack.util.io.BleachFileHelper) Random(java.util.Random) ParticleManager(org.bleachhack.gui.effect.ParticleManager) WindowTextWidget(org.bleachhack.gui.window.widget.WindowTextWidget) ItemStack(net.minecraft.item.ItemStack) Window(org.bleachhack.gui.window.Window) MutableText(net.minecraft.text.MutableText) SharedConstants(net.minecraft.SharedConstants) JsonPrimitive(com.google.gson.JsonPrimitive) WindowScreen(org.bleachhack.gui.window.WindowScreen) I18n(net.minecraft.client.resource.language.I18n) UI(org.bleachhack.module.mods.UI) BleachHack(org.bleachhack.BleachHack) MatrixStack(net.minecraft.client.util.math.MatrixStack) Items(net.minecraft.item.Items) TextColor(net.minecraft.text.TextColor) WindowButtonWidget(org.bleachhack.gui.window.widget.WindowButtonWidget) OptionsScreen(net.minecraft.client.gui.screen.option.OptionsScreen) BleachOnlineMang(org.bleachhack.util.io.BleachOnlineMang) TitleScreen(net.minecraft.client.gui.screen.TitleScreen) List(java.util.List) MultiplayerScreen(net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen) MathHelper(net.minecraft.util.math.MathHelper) RealmsMainScreen(net.minecraft.client.realms.gui.screen.RealmsMainScreen) MutableText(net.minecraft.text.MutableText) JsonPrimitive(com.google.gson.JsonPrimitive) OptionsScreen(net.minecraft.client.gui.screen.option.OptionsScreen) WindowTextWidget(org.bleachhack.gui.window.widget.WindowTextWidget) JsonObject(com.google.gson.JsonObject) WindowButtonWidget(org.bleachhack.gui.window.widget.WindowButtonWidget) TitleScreen(net.minecraft.client.gui.screen.TitleScreen) MultiplayerScreen(net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen) RealmsMainScreen(net.minecraft.client.realms.gui.screen.RealmsMainScreen) ItemStack(net.minecraft.item.ItemStack) SelectWorldScreen(net.minecraft.client.gui.screen.world.SelectWorldScreen) LiteralText(net.minecraft.text.LiteralText)

Aggregations

ItemStack (net.minecraft.item.ItemStack)3 LiteralText (net.minecraft.text.LiteralText)3 Window (org.bleachhack.gui.window.Window)3 WindowTextWidget (org.bleachhack.gui.window.widget.WindowTextWidget)3 MatrixStack (net.minecraft.client.util.math.MatrixStack)2 Items (net.minecraft.item.Items)2 HoverEvent (net.minecraft.text.HoverEvent)2 WindowScreen (org.bleachhack.gui.window.WindowScreen)2 WindowButtonWidget (org.bleachhack.gui.window.widget.WindowButtonWidget)2 WindowScrollbarWidget (org.bleachhack.gui.window.widget.WindowScrollbarWidget)2 WindowWidget (org.bleachhack.gui.window.widget.WindowWidget)2 JsonObject (com.google.gson.JsonObject)1 JsonPrimitive (com.google.gson.JsonPrimitive)1 BodyHandlers (java.net.http.HttpResponse.BodyHandlers)1 List (java.util.List)1 Random (java.util.Random)1 FabricLoader (net.fabricmc.loader.api.FabricLoader)1 SharedConstants (net.minecraft.SharedConstants)1 Screen (net.minecraft.client.gui.screen.Screen)1 TitleScreen (net.minecraft.client.gui.screen.TitleScreen)1