Search in sources :

Example 6 with Window

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

the class AccountManagerScreen method init.

public void init() {
    super.init();
    Window mainWindow = addWindow(new Window(width / 8, height / 8, width - width / 8, height - height / 8, "Accounts", new ItemStack(Items.PAPER)));
    int w = mainWindow.x2 - mainWindow.x1;
    int h = mainWindow.y2 - mainWindow.y1;
    int listW = Math.max(140, w / 3);
    // Right side
    loginResult = mainWindow.addWidget(new WindowTextWidget(loginResult != null ? loginResult.getText() : LiteralText.EMPTY, true, listW + 11, 96, 0xc0c0c0));
    mainWindow.addWidget(new WindowButtonWidget(w - 70, h - 22, w - 3, h - 3, "Login", () -> {
        if (Option.PLAYERLIST_SHOW_AS_BH_USER.getValue())
            BleachHack.playerMang.stopPinger();
        Account account = accounts.get(selected);
        for (int i = 0; i < textFieldWidgets.size(); i++) {
            account.input[i] = textFieldWidgets.get(i).textField.getText();
        }
        AuthenticationException exception = account.login();
        loginResult.setText(new LiteralText(exception == null ? "\u00a7aLogin Successful!" : "\u00a7c" + exception.getMessage()));
        account.success = exception == null ? 2 : 1;
        saveAccounts();
        if (Option.PLAYERLIST_SHOW_AS_BH_USER.getValue())
            BleachHack.playerMang.startPinger();
    }));
    rightsideWidgets.addAll(mainWindow.getWidgets());
    updateRightside();
    // Left side
    scrollbar = mainWindow.addWidget(new WindowScrollbarWidget(listW - 10, 28, accounts == null ? 0 : accounts.size() * 28 - 1, h - 29, 0));
    if (accounts == null) {
        accounts = new ArrayList<>();
        BleachFileMang.createFile("logins.txt");
        for (String s : BleachFileMang.readFileLines("logins.txt")) {
            addAccount(Account.deserialize(s.replace("\r", "").replace("\n", "").split(":", -1)));
        }
    }
    mainWindow.addWidget(new WindowTextWidget("Accounts", true, 6, 17, 0xf0f0f0));
    mainWindow.addWidget(new WindowButtonWidget(listW - 14, 14, listW - 2, 26, "\u00a7a+", () -> {
        selectWindow(1);
        removeWindow(2);
    }));
    mainWindow.addWidget(new WindowButtonWidget(listW - 29, 14, listW - 17, 26, "\u00a7c-", () -> {
        if (selected >= 0 && selected < accounts.size()) {
            accounts.remove(selected);
            selected = -1;
            scrollbar.setTotalHeight(accounts.size() * 28 - 1);
            updateRightside();
            saveAccounts();
        }
    }).withRenderEvent((wg, ms, wx, wy) -> ((WindowButtonWidget) wg).text = selected >= 0 && selected < accounts.size() ? "\u00a7c-" : "\u00a77-"));
    // Select type to add window
    Window typeWindow = addWindow(new Window(width / 2 - 96, height / 2 - 17, width / 2 + 96, height / 2 + 17, "Add Account..", new ItemStack(Items.LIME_GLAZED_TERRACOTTA), true));
    typeWindow.addWidget(new WindowButtonWidget(3, 15, 63, 31, "No Auth", () -> openAddAccWindow(AccountType.NO_AUTH, "No Auth", new ItemStack(Items.LIGHT_BLUE_GLAZED_TERRACOTTA))));
    typeWindow.addWidget(new WindowButtonWidget(66, 15, 126, 31, "Mojang", () -> openAddAccWindow(AccountType.MOJANG, "Mojang", new ItemStack(Items.GREEN_GLAZED_TERRACOTTA))));
    typeWindow.addWidget(new WindowButtonWidget(129, 15, 189, 31, "Microsoft", () -> openAddAccWindow(AccountType.MICROSOFT, "Microsoft", new ItemStack(Items.PURPLE_GLAZED_TERRACOTTA))));
}
Also used : Window(org.bleachhack.gui.window.Window) FabricLoader(net.fabricmc.loader.api.FabricLoader) IntStream(java.util.stream.IntStream) LiteralText(net.minecraft.text.LiteralText) java.util(java.util) URL(java.net.URL) GameProfile(com.mojang.authlib.GameProfile) Session(net.minecraft.client.util.Session) JsonParser(com.google.gson.JsonParser) BleachFileMang(org.bleachhack.util.io.BleachFileMang) LoginHelper(org.bleachhack.util.auth.LoginHelper) ItemStack(net.minecraft.item.ItemStack) SoundEvents(net.minecraft.sound.SoundEvents) Pair(org.apache.commons.lang3.tuple.Pair) DrawableHelper(net.minecraft.client.gui.DrawableHelper) Window(org.bleachhack.gui.window.Window) BleachLogger(org.bleachhack.util.BleachLogger) SharedConstants(net.minecraft.SharedConstants) DefaultSkinHelper(net.minecraft.client.util.DefaultSkinHelper) org.bleachhack.gui.window.widget(org.bleachhack.gui.window.widget) Type(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type) WindowScreen(org.bleachhack.gui.window.WindowScreen) Resources(com.google.common.io.Resources) AuthenticationException(com.mojang.authlib.exceptions.AuthenticationException) BleachHack(org.bleachhack.BleachHack) MatrixStack(net.minecraft.client.util.math.MatrixStack) LoginCrypter(org.bleachhack.util.auth.LoginCrypter) Items(net.minecraft.item.Items) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) PositionedSoundInstance(net.minecraft.client.sound.PositionedSoundInstance) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) Identifier(net.minecraft.util.Identifier) MinecraftClient(net.minecraft.client.MinecraftClient) Option(org.bleachhack.setting.option.Option) AuthenticationException(com.mojang.authlib.exceptions.AuthenticationException) ItemStack(net.minecraft.item.ItemStack) LiteralText(net.minecraft.text.LiteralText)

Example 7 with Window

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

the class CmdClickGui method onCommand.

@Override
public void onCommand(String alias, String[] args) throws Exception {
    if (args.length != 1 && args.length != 2) {
        throw new CmdSyntaxException();
    }
    if (args[0].equalsIgnoreCase("reset")) {
        if (args.length == 1 || args[1].equalsIgnoreCase("closed")) {
            int y = 50;
            for (Window m : ModuleClickGuiScreen.INSTANCE.getWindows()) {
                if (m instanceof ClickGuiWindow) {
                    ((ClickGuiWindow) m).hiding = true;
                    m.x1 = 30;
                    m.y1 = y;
                    y += 16;
                }
            }
        } else if (args[1].equalsIgnoreCase("open")) {
            int x = 10;
            for (Window m : ModuleClickGuiScreen.INSTANCE.getWindows()) {
                if (m instanceof ClickGuiWindow) {
                    ((ClickGuiWindow) m).hiding = false;
                    m.x1 = x;
                    m.y1 = 35;
                    x += ModuleManager.getModule(ClickGui.class).getSetting(0).asSlider().getValueInt() + 5;
                }
            }
        } else {
            throw new CmdSyntaxException("Invalid reset mode!");
        }
        BleachFileHelper.SCHEDULE_SAVE_CLICKGUI.set(true);
        BleachLogger.info("Reset the clickgui!");
    } else if (args[0].equalsIgnoreCase("length")) {
        if (!NumberUtils.isCreatable(args[1])) {
            throw new CmdSyntaxException("Invalid clickgui length: " + args[1]);
        }
        ModuleManager.getModule(ClickGui.class).getSetting(0).asSlider().setValue(NumberUtils.createNumber(args[1]).doubleValue());
        BleachFileHelper.SCHEDULE_SAVE_MODULES.set(true);
        BleachLogger.info("Set the clickgui length to: " + args[1]);
    } else {
        throw new CmdSyntaxException();
    }
}
Also used : Window(org.bleachhack.gui.window.Window) ClickGuiWindow(org.bleachhack.gui.clickgui.window.ClickGuiWindow) CmdSyntaxException(org.bleachhack.command.exception.CmdSyntaxException) ClickGuiWindow(org.bleachhack.gui.clickgui.window.ClickGuiWindow)

Example 8 with Window

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

the class AccountManagerScreen method openAddAccWindow.

private void openAddAccWindow(AccountType type, String name, ItemStack item) {
    getWindow(1).closed = true;
    int h = 40 + type.inputs.length * 40;
    Window addWindow = addWindow(new Window(width / 2 - 80, height / 2 - h / 2, width / 2 + 80, height / 2 + h / 2, "Add " + name + " Account", item));
    WindowTextWidget result = addWindow.addWidget(new WindowTextWidget("", true, 10, h - 16, -1));
    List<WindowTextFieldWidget> tf = new ArrayList<>();
    for (int i = 0; i < type.inputs.length; i++) {
        addWindow.addWidget(new WindowTextWidget(type.getInputs()[i].getLeft(), true, 10, 20 + i * 40, 0xf0f0f0));
        if (type.getInputs()[i].getRight()) {
            tf.add(addWindow.addWidget(new WindowPassTextFieldWidget(10, 33 + i * 40, 140, 18, "")));
        } else {
            tf.add(addWindow.addWidget(new WindowTextFieldWidget(10, 33 + i * 40, 140, 18, "")));
        }
    }
    addWindow.addWidget(new WindowButtonWidget(100, h - 20, 157, h - 3, "Add", () -> {
        Account account = new Account(type, 0, null, null, tf.stream().map(t -> t.textField.getText()).toArray(String[]::new));
        try {
            Session session = account.getSesson();
            account.uuid = session.getUuid();
            account.username = session.getUsername();
            addAccount(account);
            getWindow(2).closed = true;
        } catch (AuthenticationException e) {
            result.setText(new LiteralText("\u00a7c" + e.getMessage()));
        }
    }));
}
Also used : Window(org.bleachhack.gui.window.Window) FabricLoader(net.fabricmc.loader.api.FabricLoader) IntStream(java.util.stream.IntStream) LiteralText(net.minecraft.text.LiteralText) java.util(java.util) URL(java.net.URL) GameProfile(com.mojang.authlib.GameProfile) Session(net.minecraft.client.util.Session) JsonParser(com.google.gson.JsonParser) BleachFileMang(org.bleachhack.util.io.BleachFileMang) LoginHelper(org.bleachhack.util.auth.LoginHelper) ItemStack(net.minecraft.item.ItemStack) SoundEvents(net.minecraft.sound.SoundEvents) Pair(org.apache.commons.lang3.tuple.Pair) DrawableHelper(net.minecraft.client.gui.DrawableHelper) Window(org.bleachhack.gui.window.Window) BleachLogger(org.bleachhack.util.BleachLogger) SharedConstants(net.minecraft.SharedConstants) DefaultSkinHelper(net.minecraft.client.util.DefaultSkinHelper) org.bleachhack.gui.window.widget(org.bleachhack.gui.window.widget) Type(com.mojang.authlib.minecraft.MinecraftProfileTexture.Type) WindowScreen(org.bleachhack.gui.window.WindowScreen) Resources(com.google.common.io.Resources) AuthenticationException(com.mojang.authlib.exceptions.AuthenticationException) BleachHack(org.bleachhack.BleachHack) MatrixStack(net.minecraft.client.util.math.MatrixStack) LoginCrypter(org.bleachhack.util.auth.LoginCrypter) Items(net.minecraft.item.Items) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) PositionedSoundInstance(net.minecraft.client.sound.PositionedSoundInstance) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) Identifier(net.minecraft.util.Identifier) MinecraftClient(net.minecraft.client.MinecraftClient) Option(org.bleachhack.setting.option.Option) AuthenticationException(com.mojang.authlib.exceptions.AuthenticationException) Session(net.minecraft.client.util.Session) LiteralText(net.minecraft.text.LiteralText)

Example 9 with Window

use of org.bleachhack.gui.window.Window 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 10 with Window

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

the class BleachOptionsScreen method init.

@Override
public void init() {
    super.init();
    addWindow(new Window(width / 8, height / 8, width - width / 8, height - height / 8, "Options", new ItemStack(Items.REDSTONE)));
    int w = getWindow(0).x2 - getWindow(0).x1;
    int h = getWindow(0).y2 - getWindow(0).y1;
    int y = 20;
    y = addCategory(0, w / 2, y, "General Settings", Option.GENERAL_CHECK_FOR_UPDATES, Option.GENERAL_SHOW_UPDATE_SCREEN);
    y = addCategory(0, w / 2, y + 15, "Playerlist Settings", Option.PLAYERLIST_SHOW_FRIENDS, Option.PLAYERLIST_SHOW_BH_USERS, Option.PLAYERLIST_SHOW_AS_BH_USER);
    y = addCategory(0, w / 2, y + 15, "Chat Settings", Option.CHAT_COMMAND_PREFIX, Option.CHAT_SHOW_SUGGESTIONS, Option.CHAT_QUICK_PREFIX);
    for (WindowWidget widget : getWindow(0).getWidgets()) {
        if (!(widget instanceof WindowScrollbarWidget)) {
            widget.cullY = true;
        }
    }
    scrollbar = getWindow(0).addWidget(new WindowScrollbarWidget(w - 11, 12, y - 7, h - 13, 0));
}
Also used : Window(org.bleachhack.gui.window.Window) WindowScrollbarWidget(org.bleachhack.gui.window.widget.WindowScrollbarWidget) ItemStack(net.minecraft.item.ItemStack) WindowWidget(org.bleachhack.gui.window.widget.WindowWidget)

Aggregations

Window (org.bleachhack.gui.window.Window)15 ItemStack (net.minecraft.item.ItemStack)9 LiteralText (net.minecraft.text.LiteralText)6 ClickGuiWindow (org.bleachhack.gui.clickgui.window.ClickGuiWindow)6 MatrixStack (net.minecraft.client.util.math.MatrixStack)5 Items (net.minecraft.item.Items)5 WindowScreen (org.bleachhack.gui.window.WindowScreen)5 JsonObject (com.google.gson.JsonObject)4 FabricLoader (net.fabricmc.loader.api.FabricLoader)4 BleachHack (org.bleachhack.BleachHack)4 URL (java.net.URL)3 SharedConstants (net.minecraft.SharedConstants)3 WindowButtonWidget (org.bleachhack.gui.window.widget.WindowButtonWidget)3 WindowScrollbarWidget (org.bleachhack.gui.window.widget.WindowScrollbarWidget)3 WindowTextWidget (org.bleachhack.gui.window.widget.WindowTextWidget)3 WindowWidget (org.bleachhack.gui.window.widget.WindowWidget)3 Resources (com.google.common.io.Resources)2 JsonElement (com.google.gson.JsonElement)2 JsonParser (com.google.gson.JsonParser)2 GameProfile (com.mojang.authlib.GameProfile)2