Начинающий
- Статус
- Оффлайн
- Регистрация
- 1 Июл 2024
- Сообщения
- 48
- Реакции
- 0
Всем привет! Есть проблема, я решил написать свою пасту на базе zenith recode и хотел написать ротацию под FunTime с GPT (не буду скрывать или отнекиваться). Однако у меня проблема что она редко попадает в ротации FunTime и дистанция удара не работает. Помогите пожалуйста исправить
Aura.java:
package zenith.zov.client.modules.impl.combat;
import com.darkmagician6.eventapi.EventTarget;
import lombok.Getter;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Pair;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import org.joml.Vector2f;
import zenith.zov.base.events.impl.player.EventMoveInput;
import zenith.zov.base.events.impl.player.EventRotate;
import zenith.zov.base.player.AttackUtil;
import zenith.zov.base.rotation.RotationTarget;
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.ModeSetting;
import zenith.zov.client.modules.api.setting.impl.MultiBooleanSetting;
import zenith.zov.client.modules.api.setting.impl.NumberSetting;
import zenith.zov.utility.game.player.*;
import zenith.zov.utility.game.player.rotation.Rotation;
import zenith.zov.utility.game.player.rotation.RotationUtil;
import java.util.List;
import static zenith.zov.utility.game.player.MovingUtil.fixMovement;
@ModuleAnnotation(
name = "Attack Aura",
category = Category.COMBAT,
description = "Бьет таргета"
)
public final class Aura extends Module {
public static final Aura INSTANCE = new Aura();
private Aura() {}
/* ROTATION MODES */
private final ModeSetting rotationMode = new ModeSetting("Ротация");
private final ModeSetting.Value hvh = new ModeSetting.Value(rotationMode, "ХВХ");
private final ModeSetting.Value hollyworld = new ModeSetting.Value(rotationMode, "HollyWorld").select();
private final ModeSetting.Value funTime = new ModeSetting.Value(rotationMode, "FunTime");
/* FUN TIME SETTINGS */
private final NumberSetting funTimeYawAmplitude = new NumberSetting("FunTime Yaw", 30, 5, 90, 1);
private final NumberSetting funTimePitchAmplitude = new NumberSetting("FunTime Pitch", 12, 2, 45, 1);
/* SPRINT MODES */
private final ModeSetting sprintMode = new ModeSetting("Сброс спринта");
private final ModeSetting.Value sprintHvh = new ModeSetting.Value(sprintMode, "ХВХ");
private final ModeSetting.Value sprintNormal = new ModeSetting.Value(sprintMode, "Нормал").select();
private final ModeSetting.Value sprintLegit = new ModeSetting.Value(sprintMode, "Легит");
private final ModeSetting.Value sprintNone = new ModeSetting.Value(sprintMode, "Нет");
/* CORRECTION */
private final ModeSetting correction = new ModeSetting("Коррекция");
private final ModeSetting.Value correctionFocus = new ModeSetting.Value(correction, "Фокус");
private final ModeSetting.Value correctionGood = new ModeSetting.Value(correction, "Свободная").select();
private final ModeSetting.Value correctionNone = new ModeSetting.Value(correction, "Нет");
/* DISTANCE */
private final NumberSetting distance = new NumberSetting("Дистанция", 6, 0.5f, 6, 0.1f);
private final NumberSetting distanceRotation = new NumberSetting("Пре-дистанция", 0.2f, 0, 6, 0.1f);
/* SETTINGS */
private final MultiBooleanSetting settings = new MultiBooleanSetting("Настройки");
private final MultiBooleanSetting.Value shieldBreak = new MultiBooleanSetting.Value(settings, "Ломать щит", true);
private final MultiBooleanSetting.Value shielRealese = new MultiBooleanSetting.Value(settings, "Отжимать щит", true);
private final MultiBooleanSetting.Value eatUseAttack = new MultiBooleanSetting.Value(settings, "Бить и есть", true);
private final MultiBooleanSetting.Value attackIgnoreWalls = new MultiBooleanSetting.Value(settings, "Бить через стены", true);
/* TARGET TYPES */
private final MultiBooleanSetting targetTypeSetting = MultiBooleanSetting.create(
"Атаковать", List.of("Игроков", "Враждебных", "Мирных")
);
/* CRITS */
private final BooleanSetting onlyCrit = new BooleanSetting("Только криты", true);
private final BooleanSetting smartCrit = new BooleanSetting(
"Умные криты", "Бьет критами если не зажата кнопка прыжка", false, onlyCrit::isEnabled
);
/* INTERNAL */
private final TargetSelector targetSelector = new TargetSelector();
private final PointFinder pointFinder = new PointFinder();
private LivingEntity target;
private boolean legitBackStop;
@Getter private boolean preAttack;
@Getter private boolean isCanAttack;
private Vector2f rotateVector = new Vector2f(0,0);
@EventTarget
public void onRotate(EventRotate e) {
if (legitBackStop) {
legitBackStop = false;
mc.options.forwardKey.setPressed(
InputUtil.isKeyPressed(mc.getWindow().getHandle(), mc.options.forwardKey.getDefaultKey().getCode())
);
}
target = updateTarget();
if (target == null) return;
Pair<Vec3d, Box> point = pointFinder.computeVector(
target,
distance.getCurrent(),
rotationManager.getCurrentRotation(),
Vec3d.ZERO,
attackIgnoreWalls.isEnabled()
);
Vec3d eyes = SimulatedPlayer.simulateLocalPlayer(1).pos.add(0, mc.player.getEyeHeight(mc.player.getPose()), 0);
Rotation baseRotation = RotationUtil.fromVec3d(point.getLeft().subtract(eyes));
preAttack = updatePreAttack();
isCanAttack = isAttack();
Rotation attackRotation = baseRotation;
/* ================= FUN TIME MAЯТНИК ================= */
if(funTime.isSelected()) {
double time = System.currentTimeMillis() / 50.0; // ускоряем вращение
float yawAmp = (float) funTimeYawAmplitude.getCurrent();
float pitchAmp = (float) funTimePitchAmplitude.getCurrent();
float targetYaw = baseRotation.getYaw() + (float)Math.sin(time) * yawAmp + (float)(Math.random()*2-1);
float targetPitch = baseRotation.getPitch() + (float)Math.sin(time*0.5) * pitchAmp + (float)(Math.random()*1-0.5);
attackRotation = new Rotation(
smoothAngle(rotateVector.x, targetYaw, 0.5f),
MathHelper.lerp(0.5f, rotateVector.y, targetPitch)
);
rotateVector.set(attackRotation.getYaw(), attackRotation.getPitch());
}
Box box = point.getRight();
Vec3d hitVec = point.getLeft();
final Rotation rotationForLambda = attackRotation;
if(isCanAttack && box.expand(0.3).contains(hitVec)
&& RaytracingUtil.rayTrace(rotationForLambda.toVector(), distance.getCurrent(), box)) {
if(sprintHvh.isSelected()){
mc.player.setSprinting(false);
mc.player.sendSprintingPacket();
}
AttackUtil.attackEntity(target);
}
rotationManager.setRotation(
new RotationTarget(rotationForLambda, ()->aimManager.rotate(aimManager.getAiSetup(), rotationForLambda), aimManager.getAiSetup()),
3, this
);
if(preAttack || isCanAttack){
updateSprint();
}
}
@EventTarget
private void onMove(EventMoveInput e){
if(correctionNone.isSelected() || target==null) return;
if(correctionFocus.isSelected()){
Rotation angle = RotationUtil.fromVec3d(target.getBoundingBox().getCenter().subtract(mc.player.getBoundingBox().getCenter()));
fixMovement(e, rotationManager.getCurrentRotation().getYaw(), angle.getYaw());
} else {
fixMovement(e, rotationManager.getCurrentRotation().getYaw(), mc.player.getYaw());
}
}
private LivingEntity updateTarget(){
TargetSelector.EntityFilter filter = new TargetSelector.EntityFilter(targetTypeSetting.getSelectedNames());
targetSelector.searchTargets(mc.world.getEntities(), distance.getCurrent()+distanceRotation.getCurrent(), attackIgnoreWalls.isEnabled());
targetSelector.validateTarget(filter::isValid);
return targetSelector.getCurrentTarget();
}
private boolean updatePreAttack(){
SimulatedPlayer sim = SimulatedPlayer.simulateLocalPlayer(1);
if(mc.player.isUsingItem() && !eatUseAttack.isEnabled()) return false;
if(mc.player.getAttackCooldownProgress(1) < 0.9f) return false;
if(onlyCrit.isEnabled() && !AttackUtil.hasPreMovementRestrictions(sim))
return AttackUtil.isPrePlayerInCriticalState(sim) || (smartCrit.isEnabled() && !mc.options.jumpKey.isPressed());
return true;
}
private boolean isAttack(){
if(mc.player.isUsingItem() && !eatUseAttack.isEnabled()) return false;
if(mc.player.getAttackCooldownProgress(1) < 0.9f) return false;
if(onlyCrit.isEnabled() && !AttackUtil.hasMovementRestrictions())
return AttackUtil.isPlayerInCriticalState() || (smartCrit.isEnabled() && !mc.options.jumpKey.isPressed());
return true;
}
private void updateSprint(){
if(!hasStopSprint()) return;
boolean sprint = mc.options.sprintKey.isPressed();
boolean forward = mc.options.forwardKey.isPressed();
if(sprintLegit.isSelected()){
sprint = false;
if(mc.player.isSprinting()){
forward = false;
legitBackStop = true;
}
}
if(sprintNormal.isSelected()){
if(mc.player.isSprinting()) mc.player.setSprinting(false);
sprint = false;
}
mc.options.sprintKey.setPressed(sprint);
mc.options.forwardKey.setPressed(forward);
}
private boolean hasStopSprint(){
return !sprintNone.isSelected() && !AttackUtil.hasMovementRestrictions();
}
public LivingEntity getTarget(){ return isEnabled()?target:null; }
private float smoothAngle(float current, float target, float speed){
float delta = MathHelper.wrapDegrees(target - current);
return current + delta*speed;
}
}