Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Часть функционала TriggerBot Zenith Recode

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
1 Июл 2024
Сообщения
59
Реакции
0
Выберите загрузчик игры
  1. Fabric
Всем привет! Написал на скорую руку триггербот на зенит рекод, думаю пойдёт под пиво, но работает

TriggerBot.java:
Expand Collapse Copy
package zenith.zov.client.modules.impl.combat;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;

import zenith.zov.base.events.impl.player.EventRotate;
import zenith.zov.base.player.AttackUtil;
import zenith.zov.client.modules.api.Category;
import zenith.zov.client.modules.api.Module;
import zenith.zov.client.modules.api.ModuleAnnotation;
import zenith.zov.client.modules.api.setting.impl.BooleanSetting;
import zenith.zov.client.modules.api.setting.impl.MultiBooleanSetting;

import zenith.zov.utility.game.player.TargetSelector;
import zenith.zov.utility.game.player.rotation.Rotation;

import java.util.List;

@ModuleAnnotation(
        name = "TriggerBot",
        category = Category.COMBAT,
        description = "Автоатака при наведении на цель"
)
public final class TriggerBot extends Module {

    public static final TriggerBot INSTANCE = new TriggerBot();
    private TriggerBot() {}

    private final BooleanSetting onlyCrits =
            new BooleanSetting("Только криты", false);

    private final BooleanSetting smartCrits =
            new BooleanSetting("Умные криты", "Бьёт критом только при зажатом прыжке", true, onlyCrits::isEnabled);

    private final BooleanSetting eatAttack =
            new BooleanSetting("Бить и есть", true);

    private final MultiBooleanSetting targets =
            MultiBooleanSetting.create(
                    "Цели",
                    List.of("Игроков", "Враждебных", "Мирных")
            );

    private final TargetSelector targetSelector = new TargetSelector();

    @EventTarget
    public void onRotate(EventRotate e) {
        if (mc.player == null || mc.world == null) return;
        
        if (mc.player.isUsingItem() && !eatAttack.isEnabled()) return;
        
        if (mc.player.getAttackCooldownProgress(1.0f) < 0.92f) return;
        
        boolean isCrit = AttackUtil.isPlayerInCriticalState();
        boolean jumpPressed = mc.options.jumpKey.isPressed();
        
        if (onlyCrits.isEnabled()) {

            if (smartCrits.isEnabled()) {
                if (mc.options.jumpKey.isPressed()) {
                    if (!isCrit) {
                        return;
                    }
                }
            } else {
                if (!isCrit) {
                    return;
                }
            }
        }

        LivingEntity target = getMouseOverTarget();
        if (target == null) return;

        AttackUtil.attackEntity(target);
    }
    
    private LivingEntity getMouseOverTarget() {
        Rotation rot = rotationManager.getCurrentRotation();
        if (rot == null) return null;

        Vec3d eyePos = mc.player.getCameraPosVec(1.0f);
        Vec3d lookDir = rot.toVector();
        Vec3d farEnd = eyePos.add(lookDir.multiply(100.0));

        targetSelector.searchTargets(mc.world.getEntities(), 100.0f, true);

        targetSelector.validateTarget(entity ->
                isValidTarget(entity) &&
                        rayTraceHit(entity, eyePos, farEnd)
        );

        return targetSelector.getCurrentTarget();
    }

    private boolean isValidTarget(Entity entity) {
        if (!(entity instanceof LivingEntity living)) return false;
        if (entity == mc.player) return false;
        if (!entity.isAlive()) return false;

        TargetSelector.EntityFilter filter =
                new TargetSelector.EntityFilter(targets.getSelectedNames());

        return filter.isValid(living);
    }

    private boolean rayTraceHit(Entity entity, Vec3d start, Vec3d end) {
        Box box = entity.getBoundingBox().expand(0.15);
        return box.raycast(start, end).isPresent();
    }
}


че думаете?) ну бля, модуль как регистрировать я уже не буду показывать, там делать нехуй
 
Всем привет! Написал на скорую руку триггербот на зенит рекод, думаю пойдёт под пиво, но работает

TriggerBot.java:
Expand Collapse Copy
package zenith.zov.client.modules.impl.combat;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;

import zenith.zov.base.events.impl.player.EventRotate;
import zenith.zov.base.player.AttackUtil;
import zenith.zov.client.modules.api.Category;
import zenith.zov.client.modules.api.Module;
import zenith.zov.client.modules.api.ModuleAnnotation;
import zenith.zov.client.modules.api.setting.impl.BooleanSetting;
import zenith.zov.client.modules.api.setting.impl.MultiBooleanSetting;

import zenith.zov.utility.game.player.TargetSelector;
import zenith.zov.utility.game.player.rotation.Rotation;

import java.util.List;

@ModuleAnnotation(
        name = "TriggerBot",
        category = Category.COMBAT,
        description = "Автоатака при наведении на цель"
)
public final class TriggerBot extends Module {

    public static final TriggerBot INSTANCE = new TriggerBot();
    private TriggerBot() {}

    private final BooleanSetting onlyCrits =
            new BooleanSetting("Только криты", false);

    private final BooleanSetting smartCrits =
            new BooleanSetting("Умные криты", "Бьёт критом только при зажатом прыжке", true, onlyCrits::isEnabled);

    private final BooleanSetting eatAttack =
            new BooleanSetting("Бить и есть", true);

    private final MultiBooleanSetting targets =
            MultiBooleanSetting.create(
                    "Цели",
                    List.of("Игроков", "Враждебных", "Мирных")
            );

    private final TargetSelector targetSelector = new TargetSelector();

    @EventTarget
    public void onRotate(EventRotate e) {
        if (mc.player == null || mc.world == null) return;
       
        if (mc.player.isUsingItem() && !eatAttack.isEnabled()) return;
       
        if (mc.player.getAttackCooldownProgress(1.0f) < 0.92f) return;
       
        boolean isCrit = AttackUtil.isPlayerInCriticalState();
        boolean jumpPressed = mc.options.jumpKey.isPressed();
       
        if (onlyCrits.isEnabled()) {

            if (smartCrits.isEnabled()) {
                if (mc.options.jumpKey.isPressed()) {
                    if (!isCrit) {
                        return;
                    }
                }
            } else {
                if (!isCrit) {
                    return;
                }
            }
        }

        LivingEntity target = getMouseOverTarget();
        if (target == null) return;

        AttackUtil.attackEntity(target);
    }
   
    private LivingEntity getMouseOverTarget() {
        Rotation rot = rotationManager.getCurrentRotation();
        if (rot == null) return null;

        Vec3d eyePos = mc.player.getCameraPosVec(1.0f);
        Vec3d lookDir = rot.toVector();
        Vec3d farEnd = eyePos.add(lookDir.multiply(100.0));

        targetSelector.searchTargets(mc.world.getEntities(), 100.0f, true);

        targetSelector.validateTarget(entity ->
                isValidTarget(entity) &&
                        rayTraceHit(entity, eyePos, farEnd)
        );

        return targetSelector.getCurrentTarget();
    }

    private boolean isValidTarget(Entity entity) {
        if (!(entity instanceof LivingEntity living)) return false;
        if (entity == mc.player) return false;
        if (!entity.isAlive()) return false;

        TargetSelector.EntityFilter filter =
                new TargetSelector.EntityFilter(targets.getSelectedNames());

        return filter.isValid(living);
    }

    private boolean rayTraceHit(Entity entity, Vec3d start, Vec3d end) {
        Box box = entity.getBoundingBox().expand(0.15);
        return box.raycast(start, end).isPresent();
    }
}


че думаете?) ну бля, модуль как регистрировать я уже не буду показывать, там делать нехуй
/del govno
 
че за rotationmanager Блять
RotationManager.java:
Expand Collapse Copy
package zenith.zov.base.rotation;

import com.darkmagician6.eventapi.EventManager;
import com.darkmagician6.eventapi.EventTarget;
import com.darkmagician6.eventapi.types.Priority;

import lombok.Getter;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
import net.minecraft.network.packet.s2c.play.PlayerRotationS2CPacket;
import net.minecraft.util.math.MathHelper;
import zenith.zov.base.events.impl.other.EventSpawnEntity;
import zenith.zov.base.events.impl.player.EventDirection;
import zenith.zov.base.events.impl.player.EventRotate;
import zenith.zov.base.events.impl.player.EventUpdate;
import zenith.zov.base.events.impl.server.EventPacket;
import zenith.zov.base.request.RequestHandler;
import zenith.zov.client.modules.impl.render.Predictions;
import zenith.zov.utility.game.other.MessageUtil;
import zenith.zov.utility.game.player.rotation.Rotation;
import zenith.zov.utility.interfaces.IMinecraft;
import zenith.zov.client.modules.api.Module;

@Getter
public class RotationManager implements IMinecraft {

    private Rotation currentRotation = new Rotation(0, 0);
    private Rotation previousRotation = new Rotation(0, 0);
    private final RequestHandler<RotationTarget> requestHandler = new RequestHandler<>();
    private final AimManager aimManager = new AimManager();
    private RotationTarget previousRotationTarget = new RotationTarget(currentRotation, () -> currentRotation, aimManager.getInstantSetup());

    private boolean setRotation = true;

    public RotationManager() {
        EventManager.register(this);

    }

    @EventTarget
    public void addLocalPlayer(EventSpawnEntity eventSpawnLocalPlayer) {
        if (eventSpawnLocalPlayer.getEntity() instanceof ClientPlayerEntity player) {


            currentRotation = new Rotation(player.getYaw(), player.getPitch());
            previousRotation = new Rotation(player.getYaw(), player.getPitch());
            previousRotationTarget = new RotationTarget(currentRotation, () -> currentRotation, aimManager.getInstantSetup());
            setRotation = true;
        }
    }

    @EventTarget(Priority.LOW)
    public void update(EventUpdate event) {

//        mc.player.prevHeadYaw = previousRotation.getYaw();
//        mc.player.prevPitch = previousRotation.getPitch();
//        mc.player.prevBodyYaw = previousRotation.getYaw();

        EventManager.call(new EventRotate());

        RotationTarget targetRotation = requestHandler.getActiveRequestValue();
        if (targetRotation != null) {


            Rotation newRot = targetRotation.rotation().get();
            previousRotation = currentRotation;
            currentRotation = newRot;
            setRotation = false;
            this.previousRotationTarget = targetRotation;
        } else {
            if (setRotation) {
                previousRotation = currentRotation;

                currentRotation = aimManager.rotate(aimManager.getInstantSetup(), new Rotation(mc.player.getYaw(),mc.player.getPitch()));

            } else {
                Rotation back = new Rotation(mc.player.getYaw(), mc.player.getPitch());

                if (currentRotation.rotationDeltaTo(back).isInRange(5)) {
                    previousRotation = currentRotation;
                    currentRotation = aimManager.rotate(aimManager.getInstantSetup(), back);
                    setRotation = true;

                } else {

                    Rotation newRot = aimManager.rotate(previousRotationTarget.rotationConfigBack(), back);

                    previousRotation = currentRotation;
                    currentRotation = newRot;


                }

            }
        }




       if(!setRotation) {
            float delta = currentRotation.getYaw() - mc.player.lastYaw;
            {
                Rotation validing = new Rotation(currentRotation.getYaw(), currentRotation.getPitch());
                if (delta > 320)
                    validing = new Rotation(mc.player.lastYaw + 300, currentRotation.getPitch()).normalize(new Rotation(mc.player.lastYaw, mc.player.lastPitch));
                if (delta < -320)
                    validing = new Rotation(mc.player.lastYaw - 300, currentRotation.getPitch()).normalize(new Rotation(mc.player.lastYaw, mc.player.lastPitch));

                currentRotation = validing;
            }
        }

        //  MessageUtil.displayMessage(MessageUtil.LogLevel.WARN, "valid " + (MathHelper.wrapDegrees(mc.player.getYaw()) + "  " + MathHelper.wrapDegrees(currentRotation.getYaw())));

        currentRotation = new Rotation(currentRotation.getYaw(), MathHelper.clamp(currentRotation.getPitch(), -90, 90));


        requestHandler.tick();

//        mc.player.setYaw(currentRotation.getYaw());
//        mc.player.setPitch(currentRotation.getPitch()


    }

    public void setRotation(RotationTarget targetRotation, int priority, Module module) {
        requestHandler.request(new RequestHandler.Request<>(2, priority, module, targetRotation));
    }

    @EventTarget
    public void direction(EventDirection direction) {

        direction.setYaw(currentRotation.getYaw());
        direction.setPitch(currentRotation.getPitch());
    }

    @EventTarget
    public void packet(EventPacket eventPacket) {


        switch (eventPacket.getPacket()) {
            case PlayerRotationS2CPacket player -> {
                currentRotation = new Rotation(player.xRot(), player.yRot());
                previousRotationTarget = new RotationTarget(currentRotation, () -> currentRotation, aimManager.getInstantSetup());
                setRotation = true;
            }

            case PlayerPositionLookS2CPacket player -> {
                currentRotation = new Rotation(player.change().yaw(), player.change().pitch());

                previousRotationTarget = new RotationTarget(currentRotation, () -> currentRotation, aimManager.getInstantSetup());
                setRotation = true;
            }
            case PlayerInteractItemC2SPacket packetItem -> {
                packetItem.yaw = currentRotation.getYaw();
                packetItem.pitch = currentRotation.getPitch();
            }
            default -> {
            }
        }
    }

}
 
Всем привет! Написал на скорую руку триггербот на зенит рекод, думаю пойдёт под пиво, но работает

TriggerBot.java:
Expand Collapse Copy
package zenith.zov.client.modules.impl.combat;

import com.darkmagician6.eventapi.EventTarget;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;

import zenith.zov.base.events.impl.player.EventRotate;
import zenith.zov.base.player.AttackUtil;
import zenith.zov.client.modules.api.Category;
import zenith.zov.client.modules.api.Module;
import zenith.zov.client.modules.api.ModuleAnnotation;
import zenith.zov.client.modules.api.setting.impl.BooleanSetting;
import zenith.zov.client.modules.api.setting.impl.MultiBooleanSetting;

import zenith.zov.utility.game.player.TargetSelector;
import zenith.zov.utility.game.player.rotation.Rotation;

import java.util.List;

@ModuleAnnotation(
        name = "TriggerBot",
        category = Category.COMBAT,
        description = "Автоатака при наведении на цель"
)
public final class TriggerBot extends Module {

    public static final TriggerBot INSTANCE = new TriggerBot();
    private TriggerBot() {}

    private final BooleanSetting onlyCrits =
            new BooleanSetting("Только криты", false);

    private final BooleanSetting smartCrits =
            new BooleanSetting("Умные криты", "Бьёт критом только при зажатом прыжке", true, onlyCrits::isEnabled);

    private final BooleanSetting eatAttack =
            new BooleanSetting("Бить и есть", true);

    private final MultiBooleanSetting targets =
            MultiBooleanSetting.create(
                    "Цели",
                    List.of("Игроков", "Враждебных", "Мирных")
            );

    private final TargetSelector targetSelector = new TargetSelector();

    @EventTarget
    public void onRotate(EventRotate e) {
        if (mc.player == null || mc.world == null) return;
       
        if (mc.player.isUsingItem() && !eatAttack.isEnabled()) return;
       
        if (mc.player.getAttackCooldownProgress(1.0f) < 0.92f) return;
       
        boolean isCrit = AttackUtil.isPlayerInCriticalState();
        boolean jumpPressed = mc.options.jumpKey.isPressed();
       
        if (onlyCrits.isEnabled()) {

            if (smartCrits.isEnabled()) {
                if (mc.options.jumpKey.isPressed()) {
                    if (!isCrit) {
                        return;
                    }
                }
            } else {
                if (!isCrit) {
                    return;
                }
            }
        }

        LivingEntity target = getMouseOverTarget();
        if (target == null) return;

        AttackUtil.attackEntity(target);
    }
   
    private LivingEntity getMouseOverTarget() {
        Rotation rot = rotationManager.getCurrentRotation();
        if (rot == null) return null;

        Vec3d eyePos = mc.player.getCameraPosVec(1.0f);
        Vec3d lookDir = rot.toVector();
        Vec3d farEnd = eyePos.add(lookDir.multiply(100.0));

        targetSelector.searchTargets(mc.world.getEntities(), 100.0f, true);

        targetSelector.validateTarget(entity ->
                isValidTarget(entity) &&
                        rayTraceHit(entity, eyePos, farEnd)
        );

        return targetSelector.getCurrentTarget();
    }

    private boolean isValidTarget(Entity entity) {
        if (!(entity instanceof LivingEntity living)) return false;
        if (entity == mc.player) return false;
        if (!entity.isAlive()) return false;

        TargetSelector.EntityFilter filter =
                new TargetSelector.EntityFilter(targets.getSelectedNames());

        return filter.isValid(living);
    }

    private boolean rayTraceHit(Entity entity, Vec3d start, Vec3d end) {
        Box box = entity.getBoundingBox().expand(0.15);
        return box.raycast(start, end).isPresent();
    }
}


че думаете?) ну бля, модуль как регистрировать я уже не буду показывать, там делать нехуй
А в чем прикол rotation util юзать? Там без нее проще же.
 
Назад
Сверху Снизу