Вопрос AutoPotion

Начинающий
Статус
Оффлайн
Регистрация
23 Июл 2023
Сообщения
78
Реакции[?]
2
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

Спастил с мор функшион авто потион и он не робит
База: рич 2.0
Код:
Java:
package ru.nettix.feature.impl.combat;

import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerPacket;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.Hand;
import ru.nettix.event.EventTarget;
import ru.nettix.event.events.impl.player.EventPreMotion;
import ru.nettix.feature.Feature;
import ru.nettix.feature.impl.FeatureCategory;
import ru.nettix.ui.settings.impl.BooleanSetting;
import ru.nettix.ui.settings.impl.NumberSetting;
import ru.nettix.utils.math.TimerHelper;

@Getter
@Setter
public class AutoPotion extends Feature {
    public TimerHelper timerHelper = new TimerHelper();
    public NumberSetting delay;
    public BooleanSetting onlyGround = new BooleanSetting("Only Ground", true, () -> true);
    public BooleanSetting strenght = new BooleanSetting("Strenght", true, () -> true);
    public BooleanSetting speed = new BooleanSetting("Speed", true, () -> true);
    public BooleanSetting fire_resistance = new BooleanSetting("Fire Resistance", true, () -> true);

    public AutoPotion() {
        super("AutoPot", FeatureCategory.Combat);
        this.delay = new NumberSetting("Throw Delay", 300, 10, 800, 10, () -> true);
        addSettings(onlyGround, strenght, speed, fire_resistance);
    }
    ItemStack held;

    @EventTarget
    public void onUpdate(EventPreMotion event) {
        if ((mc.currentScreen instanceof InventoryScreen)) {
            return;
        }
        if (onlyGround.getBoolValue() && !mc.player.isOnGround()) {
            return;
        }
        if (timerHelper.hasReached(delay.getNumberValue())) {
            if (!mc.player.isPotionActive((Effect.get(1))) && isPotionOnHotBar(Potions.SPEED)) {
                if (mc.player.isOnGround()) {
                    event.setPitch(90);
                } else {
                    event.setPitch(-90);

                }
                if (mc.player.isOnGround()) {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, 90, mc.player.isOnGround()));
                } else {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, -90, mc.player.isOnGround()));
                }
                if (mc.player.isOnGround()) {
                    if (event.getPitch() == 90) {
                        throwPot(Potions.SPEED);
                    }
                } else {
                    if (event.getPitch() == -90) {
                        throwPot(Potions.SPEED);
                    }
                }
            }
            if (!mc.player.isPotionActive((Effect.get(5))) && isPotionOnHotBar(Potions.STRENGTH)) {
                if (mc.player.isOnGround()) {
                    event.setPitch(90);
                } else {
                    event.setPitch(-90);
                }
                if (mc.player.isOnGround()) {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, 90, mc.player.isOnGround()));
                } else {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, -90, mc.player.isOnGround()));
                }
                if (mc.player.isOnGround()) {
                    if (event.getPitch() == 90) {
                        throwPot(Potions.STRENGTH);
                    }
                } else {
                    if (event.getPitch() == -90) {
                        throwPot(Potions.STRENGTH);
                    }
                }
            }
            if (!mc.player.isPotionActive((Effect.get(12))) && isPotionOnHotBar(Potions.FIRERES)) {
                if (mc.player.isOnGround()) {
                    event.setPitch(90);
                } else {
                    event.setPitch(-90);
                }
                if (mc.player.isOnGround()) {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, 90, mc.player.isOnGround()));
                } else {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, -90, mc.player.isOnGround()));
                }
                if (mc.player.isOnGround()) {
                    if (event.getPitch() == 90) {
                        throwPot(Potions.FIRERES);
                    }
                } else {
                    if (event.getPitch() == -90) {
                        throwPot(Potions.FIRERES);
                    }
                }
            }
            timerHelper.reset();
        }
    }

    void throwPot(Potions potion) {
        int slot = getPotionSlot(potion);
        mc.player.connection.sendPacket(new CHeldItemChangePacket(slot));
        mc.player.connection.sendPacket(new CHeldItemChangePacket(Hand.MAIN_HAND.ordinal()));
        mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
    }

    public int getPotionSlot(Potions potion) {
        for (int i = 0; i < 9; ++i) {
            if (this.isStackPotion(mc.player.inventory.getStackInSlot(i), potion))
                return i;
        }
        return -1;
    }

    public boolean isPotionOnHotBar(Potions potions) {
        for (int i = 0; i < 9; ++i) {
            if (isStackPotion(mc.player.inventory.getStackInSlot(i), potions)) {
                return true;
            }
        }
        return false;
    }

    public boolean isStackPotion(ItemStack stack, Potions potion) {
        if (stack == null)
            return false;

        Item item = stack.getItem();

        if (item == Items.SPLASH_POTION) {
            int id = 5;

            switch (potion) {
                case STRENGTH: {
                    break;
                }
                case SPEED: {
                    id = 1;
                    break;
                }
                case FIRERES: {
                    id = 12;
                    break;
                }
            }

            for (EffectInstance effect : PotionUtils.getEffectsFromStack(stack)) {
                if (effect.getPotion() == Effect.get(id)) {
                    return true;
                }
            }
        }
        return false;
    }

    enum Potions {
        STRENGTH, SPEED, FIRERES
    }
}
 
Начинающий
Статус
Оффлайн
Регистрация
7 Сен 2023
Сообщения
66
Реакции[?]
0
Поинты[?]
0
Спастил с мор функшион авто потион и он не робит
База: рич 2.0
Код:
Java:
package ru.nettix.feature.impl.combat;

import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.network.play.client.CPlayerPacket;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.PotionUtils;
import net.minecraft.util.Hand;
import ru.nettix.event.EventTarget;
import ru.nettix.event.events.impl.player.EventPreMotion;
import ru.nettix.feature.Feature;
import ru.nettix.feature.impl.FeatureCategory;
import ru.nettix.ui.settings.impl.BooleanSetting;
import ru.nettix.ui.settings.impl.NumberSetting;
import ru.nettix.utils.math.TimerHelper;

@Getter
@Setter
public class AutoPotion extends Feature {
    public TimerHelper timerHelper = new TimerHelper();
    public NumberSetting delay;
    public BooleanSetting onlyGround = new BooleanSetting("Only Ground", true, () -> true);
    public BooleanSetting strenght = new BooleanSetting("Strenght", true, () -> true);
    public BooleanSetting speed = new BooleanSetting("Speed", true, () -> true);
    public BooleanSetting fire_resistance = new BooleanSetting("Fire Resistance", true, () -> true);

    public AutoPotion() {
        super("AutoPot", FeatureCategory.Combat);
        this.delay = new NumberSetting("Throw Delay", 300, 10, 800, 10, () -> true);
        addSettings(onlyGround, strenght, speed, fire_resistance);
    }
    ItemStack held;

    @EventTarget
    public void onUpdate(EventPreMotion event) {
        if ((mc.currentScreen instanceof InventoryScreen)) {
            return;
        }
        if (onlyGround.getBoolValue() && !mc.player.isOnGround()) {
            return;
        }
        if (timerHelper.hasReached(delay.getNumberValue())) {
            if (!mc.player.isPotionActive((Effect.get(1))) && isPotionOnHotBar(Potions.SPEED)) {
                if (mc.player.isOnGround()) {
                    event.setPitch(90);
                } else {
                    event.setPitch(-90);

                }
                if (mc.player.isOnGround()) {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, 90, mc.player.isOnGround()));
                } else {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, -90, mc.player.isOnGround()));
                }
                if (mc.player.isOnGround()) {
                    if (event.getPitch() == 90) {
                        throwPot(Potions.SPEED);
                    }
                } else {
                    if (event.getPitch() == -90) {
                        throwPot(Potions.SPEED);
                    }
                }
            }
            if (!mc.player.isPotionActive((Effect.get(5))) && isPotionOnHotBar(Potions.STRENGTH)) {
                if (mc.player.isOnGround()) {
                    event.setPitch(90);
                } else {
                    event.setPitch(-90);
                }
                if (mc.player.isOnGround()) {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, 90, mc.player.isOnGround()));
                } else {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, -90, mc.player.isOnGround()));
                }
                if (mc.player.isOnGround()) {
                    if (event.getPitch() == 90) {
                        throwPot(Potions.STRENGTH);
                    }
                } else {
                    if (event.getPitch() == -90) {
                        throwPot(Potions.STRENGTH);
                    }
                }
            }
            if (!mc.player.isPotionActive((Effect.get(12))) && isPotionOnHotBar(Potions.FIRERES)) {
                if (mc.player.isOnGround()) {
                    event.setPitch(90);
                } else {
                    event.setPitch(-90);
                }
                if (mc.player.isOnGround()) {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, 90, mc.player.isOnGround()));
                } else {
                    mc.player.connection.sendPacket(new CPlayerPacket.RotationPacket(mc.player.rotationYaw, -90, mc.player.isOnGround()));
                }
                if (mc.player.isOnGround()) {
                    if (event.getPitch() == 90) {
                        throwPot(Potions.FIRERES);
                    }
                } else {
                    if (event.getPitch() == -90) {
                        throwPot(Potions.FIRERES);
                    }
                }
            }
            timerHelper.reset();
        }
    }

    void throwPot(Potions potion) {
        int slot = getPotionSlot(potion);
        mc.player.connection.sendPacket(new CHeldItemChangePacket(slot));
        mc.player.connection.sendPacket(new CHeldItemChangePacket(Hand.MAIN_HAND.ordinal()));
        mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
    }

    public int getPotionSlot(Potions potion) {
        for (int i = 0; i < 9; ++i) {
            if (this.isStackPotion(mc.player.inventory.getStackInSlot(i), potion))
                return i;
        }
        return -1;
    }

    public boolean isPotionOnHotBar(Potions potions) {
        for (int i = 0; i < 9; ++i) {
            if (isStackPotion(mc.player.inventory.getStackInSlot(i), potions)) {
                return true;
            }
        }
        return false;
    }

    public boolean isStackPotion(ItemStack stack, Potions potion) {
        if (stack == null)
            return false;

        Item item = stack.getItem();

        if (item == Items.SPLASH_POTION) {
            int id = 5;

            switch (potion) {
                case STRENGTH: {
                    break;
                }
                case SPEED: {
                    id = 1;
                    break;
                }
                case FIRERES: {
                    id = 12;
                    break;
                }
            }

            for (EffectInstance effect : PotionUtils.getEffectsFromStack(stack)) {
                if (effect.getPotion() == Effect.get(id)) {
                    return true;
                }
            }
        }
        return false;
    }

    enum Potions {
        STRENGTH, SPEED, FIRERES
    }
}
кинь скрин ошибок
 
Сверху Снизу