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

Вопрос Как сделать стрейфы/таргет стрейфы под грим(аресмайн)

Это не стрейфы, а ускорение (спиды) от коллизии к цели, вот есть код:
*он взят с рокстара альфы*

Код:
Expand Collapse Copy
public class Boost extends Mode {
    Mode.Element notBoost = new Mode.Element(this, "Нет");
    Mode.Element direct = new Mode.Element(this, "Прямо");
    Mode.Element toTarget = new Mode.Element(this, "На цель");

    Mode boostMode = new Mode(toTarget, "Режим");
    Mode.Element spooky = new Mode.Element(boostMode, "Spooky");
    Mode.Element custom = new Mode.Element(boostMode, "Свой");

    Slider fallingSpeed = new Slider(toTarget, "Скорость падения").min(0).max(0.4f).inc(0.01f).set(0.3f).desc("Ускорение игрока падая").vis(() -> custom.get());
    Slider jumpSpeed = new Slider(toTarget, "Скорость прыжка").min(0).max(0.4f).inc(0.01f).set(0.3f).desc("Ускорение игрока в прыжке").vis(() -> custom.get());
    Slider groundSpeed = new Slider(toTarget, "Скорость на земле").min(0).max(0.4f).inc(0.01f).set(0).desc("Ускорение игрока на земле").vis(() -> custom.get());
    Slider centrifugals = new Slider(toTarget, "Центробежная сила").min(0).max(0.3f).inc(0.01f).set(0).desc("Отклонение от центра для вращения").vis(() -> custom.get());
    Slider multiplier = new Slider(toTarget, "Множитель").min(-0.2f).max(3).inc(0.01f).set(-0.1f).desc("Множитель ускорения. Увеличивает хитбокс обнаружения коллизии цели");

    public Boost(Bindable parent) {
        super(parent, "Ускорение");
    }

    TimerUtil collisionTimer = new TimerUtil();
    TimerUtil waitTimer = new TimerUtil();
    boolean disabled;

    public void event(Event event, LivingEntity target) {
        if (event instanceof EventTick && target != null) {
            if (direct.get()) {
                if (Player.collide(target)) {
                    float p = mc.world.getBlockState(mc.player.getPosition().add(mc.player.getMotion().x, mc.player.getMotion().y, mc.player.getMotion().z)).getBlock().getSlipperiness();
                    float f = mc.player.isOnGround() ? p * 1 : (Server.is("infinity") ? 0.91f : 0.81f);
                    float f2 = mc.player.isOnGround() ? p : 0.99f;

                    mc.player.setVelocity(mc.player.getMotion().getX() / f * f2, mc.player.getMotion().getY(), mc.player.getMotion().getZ() / f * f2);
                }
            } else if (toTarget.get()) {
                float mult = multiplier.get();

                if (Player.collide(target, mult) && !disabled) {
                    Vector3d playerPos = mc.player.getPositionVec();
                    Vector3d targetPos = target.getPositionVec();

                    Vector3d direction = targetPos.subtract(playerPos).normalize();

                    float p = mc.world.getBlockState(mc.player.getPosition().add(mc.player.getMotion().x, mc.player.getMotion().y, mc.player.getMotion().z))
                            .getBlock().getSlipperiness();
                    float f = mc.player.isOnGround() ? p * 1 : 0.91f;
                    float f2 = mc.player.isOnGround() ? p : 0.73f;

                    double motionY = mc.player.getMotion().y;

                    float ground = spooky.get() ? (Player.collide(target) ? 0.1f : 0.05f) : groundSpeed.get();
                    float falling = spooky.get() ? 0.05f : fallingSpeed.get();
                    float jump = spooky.get() ? 0.05f : jumpSpeed.get();

                    float forward = 1 + Math.max(mc.player.moveForward, mc.player.moveStrafing) / 15;

                    float gradus = System.currentTimeMillis() / 100;
                    float centrifugal = spooky.get() ? 0f : centrifugals.get();
                    float deviationX = (float) Math.cos(Math.toDegrees(gradus)) * centrifugal;
                    float deviationZ = (float) Math.sin(Math.toDegrees(gradus)) * centrifugal;
                    direction = direction.add(deviationX, 0, deviationZ);

                    double speed = (mc.player.isOnGround() ? ground : mc.player.fallDistance > 0 ? falling : jump);
                    double newX = direction.x * speed * f2 / f / forward;
                    double newZ = direction.z * speed * f2 / f / forward;

                    mc.player.setVelocity(mc.player.getMotion().x + newX, motionY, mc.player.getMotion().z + newZ);
                } else {
                    collisionTimer.reset();

                    if (disabled && waitTimer.elapsed(1000)) {
                        disabled = false;
                    }
                }
            }
        }
    }
}

потом создаешь в киллке своей это как
Boost bost = new Boost()
и в ивенте:
bost.event(event, this.target)
 
Назад
Сверху Снизу