Начинающий
- Статус
- Оффлайн
- Регистрация
- 20 Май 2023
- Сообщения
- 14
- Реакции
- 1
- Выберите загрузчик игры
- Fabric
Пожалуйста, авторизуйтесь для просмотра ссылки.
можете попробовать убрать тряску, вроде без неё тоже работает
Код:
package ru.dyxazhanin.implement.features.modules.combat.attack.killaura.rotation.angle;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import ru.dyxazhanin.common.util.other.StopWatch;
import ru.dyxazhanin.core.Main;
import ru.dyxazhanin.implement.features.modules.combat.attack.Aura;
import ru.dyxazhanin.implement.features.modules.combat.attack.killaura.attack.AttackHandler;
import ru.dyxazhanin.implement.features.modules.combat.attack.killaura.rotation.Angle;
import ru.dyxazhanin.implement.features.modules.combat.attack.killaura.rotation.AngleUtil;
import ru.dyxazhanin.implement.features.modules.combat.attack.killaura.rotation.RaytracingUtil;
import java.security.SecureRandom;
public class LonyGriefSmoothMode extends AngleSmoothMode {
private final SecureRandom random = new SecureRandom();
@Override
public Angle limitAngleChange(Angle currentAngle, Angle targetAngle, Vec3d vec3d, Entity entity) {
Angle angleDelta = AngleUtil.calculateDelta(currentAngle, targetAngle);
Aura aura = Aura.getInstance();
AttackHandler attackHandler = Main.getInstance().getAttackPerpetrator().getAttackHandler();
StopWatch attackTimer = attackHandler.getAttackTimer();
float yawDelta = angleDelta.getYaw();
float pitchDelta = angleDelta.getPitch();
float rotationDifference = (float) Math.hypot(Math.abs(yawDelta), Math.abs(pitchDelta));
double den4ik = attackTimer.elapsedTime();
double timeForYaw = den4ik / 60.0;
double timeForPitch = den4ik / 40.0;
float attackJitterMultiplier = canAttack(0) ? 0.3f : 1.0f;
float jitterYaw = (float) (randomLerp(3f, 6f) * Math.cos(timeForYaw)) * attackJitterMultiplier;
float jitterPitch = (float) (randomLerp(2f, 4f) * Math.sin(timeForPitch)) * attackJitterMultiplier;
boolean visible = RaytracingUtil.rayTrace(aura.getConfig());
float lineYaw = (Math.abs(yawDelta / rotationDifference) * 180.0F);
float linePitch = (Math.abs(pitchDelta / rotationDifference) * 180.0F);
float moveYaw = MathHelper.clamp(yawDelta, -lineYaw, lineYaw);
float movePitch = MathHelper.clamp(pitchDelta, -linePitch, linePitch);
boolean attack = !attackTimer.finished(250);
float lerp;
if (!visible) {
lerp = randomLerp(0.5f, 0.7f);
} else {
lerp = randomLerp(0.25f, 0.35f);
}
if (attack) {
if (random.nextFloat() < 0.1f) {
lerp = randomLerp(0.5f, 0.8f);
} else {
lerp = randomLerp(0.3f, 0.45f);
}
}
Angle moveAngle = new Angle(currentAngle.getYaw(), currentAngle.getPitch());
moveAngle.setYaw(MathHelper.lerp(lerp, currentAngle.getYaw(), currentAngle.getYaw() + moveYaw) + jitterYaw);
moveAngle.setPitch(MathHelper.lerp(lerp, currentAngle.getPitch(), currentAngle.getPitch() + movePitch) + jitterPitch);
return moveAngle;
}
@Override
public Vec3d randomValue() {
return Vec3d.ZERO;
}
private boolean canAttack(int ticks) {
Aura aura = Aura.getInstance();
return aura.getTarget() != null && Main.getInstance().getAttackPerpetrator().getAttackHandler().canCrit(aura.getConfig(), ticks);
}
private float randomLerp(float min, float max) {
return MathHelper.lerp(random.nextFloat(), min, max);
}
}