Начинающий
- Статус
- Оффлайн
- Регистрация
- 27 Май 2024
- Сообщения
- 26
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Достал килку из релеона перенес на свою базу подфиксил протестил 200-150 критов и не режет+не банит отходил 3-4 ивента
Пожалуйста, авторизуйтесь для просмотра ссылки.
java:
package fun.rich.utils.features.aura.rotations.impl;
import fun.rich.Rich;
import fun.rich.features.impl.combat.Aura;
import fun.rich.utils.features.aura.rotations.constructor.RotateConstructor;
import fun.rich.utils.features.aura.striking.StrikeManager;
import fun.rich.utils.features.aura.utils.MathAngle;
import fun.rich.utils.features.aura.warp.Turns;
import fun.rich.utils.math.time.StopWatch;
import java.security.SecureRandom;
import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
public class FTAngle extends RotateConstructor {
private static final int BASE_BOOST_TRIGGER_CHANCE = 7;
private static final int MAX_BOOST_TRIGGER_CHANCE = 30;
private static final SecureRandom RANDOM = new SecureRandom();
private static long nextBoostAttemptTime = 0L;
private static int boostTriggerChance = BASE_BOOST_TRIGGER_CHANCE;
private long nextRollTime = 0L;
private long boostEndTime = 0L;
private int swingCount = 0;
private boolean hasSwungTwice = false;
private boolean hasSwung = false;
private boolean disableRotation = false;
private int lastBoostHitCount = -1;
private final Random random1 = new Random();
public FTAngle() {
super("FunTime");
}
@Override
public Turns limitAngleChange(Turns currentTurns, Turns targetTurns, Vec3d vec3d, Entity entity) {
Aura aura = Aura.getInstance();
boolean auraActive = aura != null && aura.isState();
StrikeManager attackHandler = Rich.getInstance().getAttackPerpetrator().getAttackHandler();
StopWatch attackTimer = attackHandler.getAttackTimer();
int hitCount = attackHandler.getCount();
Turns deltaTurns = MathAngle.calculateDelta(currentTurns, targetTurns);
float yawDelta = deltaTurns.getYaw();
float pitchDelta = deltaTurns.getPitch();
float totalDelta = (float) Math.hypot(Math.abs(yawDelta), Math.abs(pitchDelta));
if (totalDelta < 1.0E-4f) {
return targetTurns;
}
if (mc.player.isOnGround()) {
return this.buildGroundRotation(
currentTurns,
yawDelta,
pitchDelta,
totalDelta,
auraActive,
aura,
attackHandler,
attackTimer,
hitCount,
entity
);
}
return this.buildAirRotation(
currentTurns,
yawDelta,
pitchDelta,
totalDelta,
auraActive,
aura,
attackHandler,
attackTimer,
hitCount,
entity
);
}
private Turns buildGroundRotation(
Turns currentTurns,
float yawDelta,
float pitchDelta,
float totalDelta,
boolean auraActive,
Aura aura,
StrikeManager attackHandler,
StopWatch attackTimer,
int hitCount,
Entity targetEntity
) {
float pitchNoise;
float yawNoise;
float noiseScale;
if (targetEntity != null && auraActive) {
boolean instantTrack = aura.getTarget() != null && attackHandler.canAttack(aura.getConfig(), 0);
float followStrength = instantTrack ? 1.0f : (RANDOM.nextBoolean() ? 1.2f : 2.0f);
float yawLimit = Math.abs(yawDelta / totalDelta) * 180.0f;
float pitchLimit = Math.abs(pitchDelta / totalDelta) * 180.0f;
float clampedYawDelta = MathHelper.clamp(yawDelta, -yawLimit, yawLimit);
float clampedPitchDelta = MathHelper.clamp(pitchDelta, -pitchLimit, pitchLimit);
Turns adjustedTurns = new Turns(currentTurns.getYaw(), currentTurns.getPitch());
float interpolation = MathHelper.clamp(this.randomBetween(followStrength, followStrength + 0.2f), 0.0f, 1.0f);
adjustedTurns.setYaw(MathHelper.lerp(interpolation, currentTurns.getYaw(), currentTurns.getYaw() + clampedYawDelta));
adjustedTurns.setPitch(MathHelper.lerp(interpolation, currentTurns.getPitch(), currentTurns.getPitch() + clampedPitchDelta));
return adjustedTurns;
}
int patternIndex = hitCount % 3;
float baseInterpolation = attackTimer.finished(1000.0) ? 1.0f : -1.0f;
float patternTime = (float) attackTimer.elapsedTime() / 40.0f + (hitCount % 6);
Turns randomOffset = switch (patternIndex) {
case 0 -> new Turns((float) Math.cos(patternTime), (float) Math.sin(patternTime));
case 1 -> new Turns((float) Math.sin(patternTime), (float) Math.cos(patternTime));
case 2 -> new Turns((float) Math.sin(patternTime), (float) (-Math.cos(patternTime)));
default -> new Turns((float) (-Math.cos(patternTime)), (float) Math.sin(patternTime));
};
boolean applyBoostJitter = this.shouldApplyBoostJitter(hitCount);
if (applyBoostJitter) {
this.lastBoostHitCount = hitCount;
}
if (applyBoostJitter) {
noiseScale = this.randomBetween(323232.0f, 298.0f) * Math.abs((float) Math.cos(System.currentTimeMillis() / 2000.0));
yawNoise = !attackTimer.finished(1000.0) ? this.randomBetween(25.0f, 26.0f) * randomOffset.getYaw() : 0.0f;
pitchNoise = !attackTimer.finished(1000.0)
? -this.randomBetween(232.0f, 232323.0f) * Math.abs(randomOffset.getPitch()) * noiseScale
: 0.0f;
} else {
yawNoise = !attackTimer.finished(1000.0) ? this.randomBetween(9.0f, 15.0f) * randomOffset.getYaw() : 0.0f;
pitchNoise = !attackTimer.finished(1000.0) ? this.randomBetween(2.0f, 7.0f) * randomOffset.getPitch() : 0.0f;
}
noiseScale = Math.abs(yawDelta / totalDelta) * 180.0f;
float pitchScale = Math.abs(pitchDelta / totalDelta) * 180.0f;
float clampedYawDelta = MathHelper.clamp(yawDelta, -noiseScale, noiseScale);
float clampedPitchDelta = MathHelper.clamp(pitchDelta, -pitchScale, pitchScale);
float interpolation = MathHelper.clamp(this.randomBetween(baseInterpolation, baseInterpolation + 0.2f), 0.0f, 1.0f);
float nextYaw = MathHelper.lerp(interpolation, currentTurns.getYaw(), currentTurns.getYaw() + clampedYawDelta) + yawNoise;
float nextPitch = MathHelper.lerp(interpolation, currentTurns.getPitch(), currentTurns.getPitch() + clampedPitchDelta) + pitchNoise;
nextPitch = applyBoostJitter
? MathHelper.clamp(nextPitch, -89.0f, 90.0f)
: MathHelper.clamp(nextPitch, -89.0f, 89.0f);
Turns resultTurns = new Turns(currentTurns.getYaw(), currentTurns.getPitch());
resultTurns.setYaw(nextYaw);
resultTurns.setPitch(nextPitch);
return resultTurns;
}
private Turns buildAirRotation(
Turns currentTurns,
float yawDelta,
float pitchDelta,
float totalDelta,
boolean auraActive,
Aura aura,
StrikeManager attackHandler,
StopWatch attackTimer,
int hitCount,
Entity targetEntity
) {
float pitchNoise;
float yawNoise;
float noiseScale;
if (targetEntity != null && auraActive) {
boolean instantTrack = aura.getTarget() != null && attackHandler.canAttack(aura.getConfig(), 0);
float followStrength = instantTrack ? 1.0f : (RANDOM.nextBoolean() ? 1.2f : 2.0f);
float yawLimit = Math.abs(yawDelta / totalDelta) * 180.0f;
float pitchLimit = Math.abs(pitchDelta / totalDelta) * 180.0f;
float clampedYawDelta = MathHelper.clamp(yawDelta, -yawLimit, yawLimit);
float clampedPitchDelta = MathHelper.clamp(pitchDelta, -pitchLimit, pitchLimit);
Turns adjustedTurns = new Turns(currentTurns.getYaw(), currentTurns.getPitch());
float interpolation = MathHelper.clamp(this.randomBetween(followStrength, followStrength + 0.2f), 0.0f, 1.0f);
adjustedTurns.setYaw(MathHelper.lerp(interpolation, currentTurns.getYaw(), currentTurns.getYaw() + clampedYawDelta));
adjustedTurns.setPitch(MathHelper.lerp(interpolation, currentTurns.getPitch(), currentTurns.getPitch() + clampedPitchDelta));
return adjustedTurns;
}
int patternIndex = hitCount % 3;
float baseInterpolation = attackTimer.finished(400.0) ? this.randomBetween(0.21f, 0.31f) : this.randomBetween(0.15f, 0.11f);
float patternTime = (float) attackTimer.elapsedTime() / 40.0f + (hitCount % 6);
Turns randomOffset = switch (patternIndex) {
case 0 -> new Turns((float) Math.cos(patternTime), (float) Math.sin(patternTime));
case 1 -> new Turns((float) Math.sin(patternTime), (float) Math.cos(patternTime));
case 2 -> new Turns((float) Math.sin(patternTime), (float) (-Math.cos(patternTime)));
default -> new Turns((float) (-Math.cos(patternTime)), (float) Math.sin(patternTime));
};
boolean applyBoostJitter = this.shouldApplyBoostJitter(hitCount);
if (applyBoostJitter) {
this.lastBoostHitCount = hitCount;
}
if (applyBoostJitter) {
noiseScale = this.randomBetween(25.0f, 32.0f) * Math.abs((float) Math.cos(System.currentTimeMillis() / 2000.0));
yawNoise = !attackTimer.finished(1000.0) ? this.randomBetween(6.0f, 10.0f) * randomOffset.getYaw() : 0.0f;
pitchNoise = !attackTimer.finished(1000.0)
? -this.randomBetween(25.0f, 35.0f) * Math.abs(randomOffset.getPitch()) * noiseScale
: 0.0f;
} else {
yawNoise = !attackTimer.finished(1000.0) ? this.randomBetween(20.0f, 26.0f) * randomOffset.getYaw() : 0.0f;
pitchNoise = !attackTimer.finished(1000.0) ? this.randomBetween(2.0f, 5.0f) * randomOffset.getPitch() : 0.0f;
}
noiseScale = Math.abs(yawDelta / totalDelta) * 180.0f;
float pitchScale = Math.abs(pitchDelta / totalDelta) * 180.0f;
float clampedYawDelta = MathHelper.clamp(yawDelta, -noiseScale, noiseScale);
float clampedPitchDelta = MathHelper.clamp(pitchDelta, -pitchScale, pitchScale);
float interpolation = MathHelper.clamp(this.randomBetween(baseInterpolation, baseInterpolation + 0.15f), 0.0f, 1.0f);
float nextYaw = MathHelper.lerp(interpolation, currentTurns.getYaw(), currentTurns.getYaw() + clampedYawDelta) + yawNoise;
float nextPitch = MathHelper.lerp(interpolation, currentTurns.getPitch(), currentTurns.getPitch() + clampedPitchDelta) + pitchNoise;
nextPitch = applyBoostJitter
? MathHelper.clamp(nextPitch, -89.0f, 90.0f)
: MathHelper.clamp(nextPitch, -89.0f, 89.0f);
Turns resultTurns = new Turns(currentTurns.getYaw(), currentTurns.getPitch());
resultTurns.setYaw(nextYaw);
resultTurns.setPitch(nextPitch);
return resultTurns;
}
@Override
public Vec3d randomValue() {
return Vec3d.ZERO;
}
private void rx() {
if (boostTriggerChance >= MAX_BOOST_TRIGGER_CHANCE) {
boostTriggerChance = BASE_BOOST_TRIGGER_CHANCE;
return;
}
boostTriggerChance = Math.min(boostTriggerChance * 2, MAX_BOOST_TRIGGER_CHANCE);
}
private boolean shouldApplyBoostJitter(int hitCount) {
return hitCount > 0
&& (hitCount % 20) * this.random1.nextFloat() == 0.0f
&& hitCount != this.lastBoostHitCount;
}
private float randomBetween(float min, float max) {
return MathHelper.lerp(RANDOM.nextFloat(), min, max);
}
}