Исходник AutoBuy для funtime 1.16.5 forge

Начинающий
Статус
Оффлайн
Регистрация
8 Апр 2023
Сообщения
186
Реакции[?]
13
Поинты[?]
17K
Авто бай -
AutoBuy:
public class buyhelper {
    public static Minecraft mc = Minecraft.getInstance();


    @SubscribeEvent
    public static void onChatMessage(ClientChatEvent e) {
        String msg = e.getMessage();
        if (msg.equals("-autobuy")) {
            e.setCanceled(true);
            Thread thread = new Thread(() -> {
                try {
                    mc.player.sendChatMessage("/ah");
                    Thread.sleep(1000);
                    startFind();
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
                }
            });
            thread.start();
        }
    }

    private static boolean checkDon(int slotitem) {
       return mc.player.openContainer.getSlot(slotitem).getStack().getDisplayName().getString().contains("★");
    }

    private static int getStackInSlotOpenContainer(int itemslot) {
        return mc.player.openContainer.getSlot(itemslot).getStack().getCount();
    }

    private static String getNBT(int itemslot) {
        return mc.player.openContainer.getSlot(itemslot).getStack().getTag().toString();
    }

    private static Item getItem(int itemslot) {
        return mc.player.openContainer.getSlot(itemslot).getStack().getItem();
    }

    private static void startFind() {
        Thread thread = new Thread(() -> {
            try {
                for (int i = 0; i < 44; i++) {
                    String nbt = getNBT(i);
                    Item item = getItem(i);
                    int price = getPrice(nbt);
                    if (checkValid(item, price, i)) {
                        String[] parts = nbt.split("Прoдaвeц:\"");
                        if (parts.length > 1) {
                            String sellerName = parts[1].split("\"")[7].replace(" ", "");
                            mc.player.sendChatMessage("/ah " + sellerName);
                            Thread.sleep(300);
                            mc.player.sendChatMessage("/ah " + sellerName);
                            Thread.sleep(500);
                            for (int i2 = 0; i2 < 44; i2++) {
                                if (mc.player.openContainer.getSlot(i2).getStack().getItem() != Items.AIR) {
                                    String nbt2 = getNBT(i2);
                                    Item item2 = getItem(i2);
                                    int price2 = getPrice(nbt2);
                                    if (checkValid(item2, price2, i2)) {
                                        quickBuy(i2);
                                        Thread.sleep((int) (Math.random() * (450 - 400 + 1)) + 450);
                                        mc.player.sendChatMessage("/ah");
                                        Thread.sleep(200);
                                        mc.player.sendChatMessage("/ah");
                                        Thread.sleep((int) (Math.random() * (450 - 400 + 1)) + 450);
                                        startFind();
                                        return;
                                    }
                                }
                            }
                            Thread.sleep(300);
                            mc.player.sendChatMessage("/ah");
                            Thread.sleep(500);
                            mc.player.sendChatMessage("/ah");
                            Thread.sleep((int) (Math.random() * (400 - 350 + 1)) + 400);
                            startFind();
                            return;
                        } else {
                            send(nbt);
                        }

                    }
                }
                Thread.sleep((int) (Math.random() * (450 - 400 + 1)) + 450);
                mc.playerController.windowClick(mc.player.openContainer.windowId, 49, 0, ClickType.QUICK_MOVE, mc.player);
                Thread.sleep((int) (Math.random() * (450 - 400 + 1)) + 450);
                startFind();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        thread.start();
    }


    private static void send(String msg) {
        mc.player.sendMessage((ITextComponent) new StringTextComponent("" + msg), null);
    }

    private static boolean checkValid(Item item, int price, int slot) {
        return (itemsMapDonFt.containsKey(item) && checkDon(slot) && price <= itemsMapDonFt.get(item))
                || (itemsMapFt.containsKey(item) && price <= itemsMapFt.get(item))
                || (itemsMapneed16stackft.containsKey(item) && getStackInSlotOpenContainer(slot) >= 16 && price <= itemsMapneed16stackft.get(item))
                || (itemsMapneed32stackft.containsKey(item) && getStackInSlotOpenContainer(slot) >= 32 && price <= itemsMapneed32stackft.get(item))
                && !mc.player.openContainer.getSlot(slot).getStack().getDisplayName().getString().contains("Сатан");
    }

    private static int getPrice(String nbt) {
        String regex = "\\$(\\d+(?:\\s\\d{3})*(?:\\.\\d{2})?)";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(nbt);
        if (matcher.find()) {
            return Integer.parseInt(matcher.group(1).replace(" ", "").replace("$", ""));
        }
        return 0;
    }

    private static void quickBuy(int slot) {
        mc.playerController.windowClick(mc.player.openContainer.windowId, slot, 0, ClickType.QUICK_MOVE, mc.player);
    }
BuyList для работы -
BuyList:
public class buyList {
    public static Map<Item, Integer> itemsMapFt = new HashMap<>();
    static {
        itemsMapFt.put(Items.NETHERITE_HELMET, 60000);
        itemsMapFt.put(Items.NETHERITE_CHESTPLATE, 60000);
        itemsMapFt.put(Items.NETHERITE_LEGGINGS, 60000);
        itemsMapFt.put(Items.NETHERITE_BOOTS, 60000);
        itemsMapFt.put(Items.NETHERITE_AXE, 60000);
        itemsMapFt.put(Items.NETHERITE_PICKAXE, 100000);
        itemsMapFt.put(Items.NETHERITE_SWORD, 50000);
        itemsMapFt.put(Items.NETHERITE_SHOVEL, 10000);
        itemsMapFt.put(Items.NETHERITE_HOE, 10000);
        itemsMapFt.put(Items.NETHER_STAR, 10000);
        itemsMapFt.put(Items.NETHERITE_SCRAP, 20000);
        itemsMapFt.put(Items.NETHERITE_INGOT, 200000);
        itemsMapFt.put(Items.NETHERITE_BLOCK, 10000);
        itemsMapFt.put(Items.ANCIENT_DEBRIS, 25000);
        itemsMapFt.put(Items.WITHER_SKELETON_SKULL, 20000);
        itemsMapFt.put(Items.DIAMOND_BLOCK, 6000);
        itemsMapFt.put(Items.CROSSBOW, 5000);
        itemsMapFt.put(Items.GOLDEN_PICKAXE, 10000);
        itemsMapFt.put(Items.ELYTRA, 120000);
        itemsMapFt.put(Items.EMERALD_ORE, 15000);
        itemsMapFt.put(Items.EMERALD_BLOCK, 5000);
        itemsMapFt.put(Items.TOTEM_OF_UNDYING, 20000);
        itemsMapFt.put(Items.CAMPFIRE, 10000);
        itemsMapFt.put(Items.BEACON, 25000);
        itemsMapFt.put(Items.SPAWNER, 1000000);
//        itemsMapFt.put(Items.TRIPWIRE_HOOK, 10000);
        itemsMapFt.put(Items.DRAGON_HEAD, 10000);
        itemsMapFt.put(Items.ENDERMAN_SPAWN_EGG, 100000);
        itemsMapFt.put(Items.WANDERING_TRADER_SPAWN_EGG, 100000);
        itemsMapFt.put(Items.ENCHANTED_GOLDEN_APPLE, 10000);
        itemsMapFt.put(Items.VILLAGER_SPAWN_EGG, 100000);
        itemsMapFt.put(Items.ZOMBIE_VILLAGER_SPAWN_EGG, 100000);
        itemsMapFt.put(Items.CREEPER_SPAWN_EGG, 5000);
        itemsMapFt.put(Items.CREEPER_HEAD, 20000);
//        itemsMapFt.put(Items.PLAYER_HEAD, 10000);
        itemsMapFt.put(Items.SHULKER_BOX, 25000);
        itemsMapFt.put(Items.WHITE_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.ORANGE_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.MAGENTA_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.LIGHT_BLUE_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.YELLOW_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.LIME_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.PINK_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.GRAY_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.LIGHT_GRAY_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.CYAN_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.PURPLE_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.BLUE_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.BROWN_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.GREEN_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.RED_SHULKER_BOX, 25000);
        itemsMapFt.put(Items.BLACK_SHULKER_BOX, 25000);
//        itemsMapFt.put(Items.POTION, 10000);
//        itemsMapFt.put(Items.DRIED_KELP, 10000);
//        itemsMapFt.put(Items.FIRE_CHARGE, 10000);
    }

    public static Map<Item, Integer> itemsMapneed16stackft = new HashMap<>();

    static {

        itemsMapneed16stackft.put(Items.EMERALD, 15000);
        itemsMapneed16stackft.put(Items.DIAMOND_ORE, 1000);
        itemsMapneed16stackft.put(Items.DIAMOND, 40000);
        itemsMapneed16stackft.put(Items.SHULKER_SHELL, 20000);
        itemsMapneed16stackft.put(Items.GOLDEN_APPLE, 25000);
        itemsMapneed16stackft.put(Items.APPLE, 40000);
        itemsMapneed16stackft.put(Items.GUNPOWDER, 75000);
        itemsMapneed16stackft.put(Items.FIREWORK_ROCKET, 15000);
        itemsMapneed16stackft.put(Items.IRON_BLOCK, 30000);
        itemsMapneed16stackft.put(Items.IRON_INGOT, 5000);
//        itemsMapneed16stackft.put(Items.IRON_NUGGET, 5000);
        itemsMapneed16stackft.put(Items.GOLD_BLOCK, 10000);
        itemsMapneed16stackft.put(Items.ENDER_PEARL, 25000);
//        itemsMapneed16stackft.put(Items.TIPPED_ARROW, 5000);
        itemsMapneed16stackft.put(Items.COBWEB, 25000);
        itemsMapneed16stackft.put(Items.CHORUS_FLOWER, 10000);
        itemsMapneed16stackft.put(Items.COOKED_PORKCHOP, 7500);
        itemsMapneed16stackft.put(Items.DRAGON_BREATH, 5000);
    }

    public static Map<Item, Integer> itemsMapneed32stackft = new HashMap<>();

    static {

        itemsMapneed32stackft.put(Items.GLOWSTONE, 10000);
        itemsMapneed32stackft.put(Items.PUFFERFISH, 10000);
        itemsMapneed32stackft.put(Items.BLAZE_POWDER, 10000);
        itemsMapneed32stackft.put(Items.BLAZE_ROD, 10000);
        itemsMapneed32stackft.put(Items.OBSIDIAN, 20000);
        itemsMapneed32stackft.put(Items.GOLD_INGOT, 10000);
        itemsMapneed32stackft.put(Items.GOLDEN_CARROT, 10000);
        itemsMapneed32stackft.put(Items.CHORUS_FLOWER, 35000);
//        itemsMapneed32stackft.put(Items.SAND, 10000);


    }

    public static Map<Item, Integer> itemsMapDonFt = new HashMap<>();
    static {
        itemsMapDonFt.put(Items.IRON_NUGGET, 5000);
        itemsMapDonFt.put(Items.FIRE_CHARGE, 10000);
        itemsMapDonFt.put(Items.DRIED_KELP, 10000);
        itemsMapDonFt.put(Items.TRIPWIRE_HOOK, 100000);
        itemsMapDonFt.put(Items.PLAYER_HEAD, 100000);
        itemsMapDonFt.put(Items.TNT, 50000);
        itemsMapDonFt.put(Items.EXPERIENCE_BOTTLE, 40000);
        itemsMapDonFt.put(Items.ENDER_EYE, 20000);
        itemsMapDonFt.put(Items.SPLASH_POTION, 3000);
    }
}
Пример работы -
Пожалуйста, авторизуйтесь для просмотра ссылки.
noad
Пишите отзывы про мой говно код и ставьте классы! :roflanPominki:
 
Начинающий
Статус
Оффлайн
Регистрация
21 Июл 2023
Сообщения
450
Реакции[?]
9
Поинты[?]
11K
у меня есть 2 вопроса
1. что за чел это кодил и нахуя
2. нахуя нужна эта строка если и без нее будет обрабатываться все норм
1697126524060.png
 
Начинающий
Статус
Оффлайн
Регистрация
8 Апр 2023
Сообщения
186
Реакции[?]
13
Поинты[?]
17K
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
7 Июн 2020
Сообщения
23
Реакции[?]
0
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
15 Янв 2023
Сообщения
64
Реакции[?]
0
Поинты[?]
0
На какую кнопку активация?
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
7 Июн 2020
Сообщения
23
Реакции[?]
0
Поинты[?]
0
Участник
Статус
Оффлайн
Регистрация
15 Янв 2020
Сообщения
451
Реакции[?]
226
Поинты[?]
16K
Сверху Снизу