использую ротацию polar иногда просто не делает удары
Код:
package ru.night.module.impl.combat;
import java.util.concurrent.ThreadLocalRandom;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.util.Hand;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.mob.SlimeEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.ShieldItem;
import net.minecraft.util.math.Vec3d;
import net.minecraft.registry.tag.ItemTags;
import net.minecraft.util.math.MathHelper;
import net.minecraft.client.network.ClientPlayerEntity;
import ru.night.Night;
import ru.night.event.EventInit;
import ru.night.event.impl.EventUpdate;
import ru.night.event.lifecycle.ClientTickEvent;
import ru.night.module.api.Category;
import ru.night.module.api.IModule;
import ru.night.module.api.Module;
import ru.night.module.api.setting.Setting;
import ru.night.module.api.setting.impl.BooleanSetting;
import ru.night.module.api.setting.impl.ModeSetting;
import ru.night.module.api.setting.impl.MultiBooleanSetting;
import ru.night.module.api.setting.impl.SliderSetting;
import ru.night.module.impl.combat.auraProcess.Attack;
import ru.night.module.impl.combat.auraProcess.Rotate;
import ru.night.module.impl.combat.auraProcess.UFunTimeRotations;
import ru.night.module.impl.combat.auraProcess.auraUtil.AuraUtil;
import ru.night.util.player.MoveUtil;
import ru.night.util.player.MovementManager;
import ru.night.util.player.PlayerUtil;
@IModule(
name = "Hit Aura",
description = "Обходил жозкий POLAR/FUNTIME/POKITIME",
category = Category.Combat,
bind = 82
)
@Environment(EnvType.CLIENT)
public class HitAura extends Module {
public static SliderSetting attackRange = new SliderSetting("Радиус атаки", 3.0F, 3.0F, 6.0F, 0.1F, false);
public static SliderSetting preRange = new SliderSetting("Радиус обнаружения", 1.0F, 0.0F, 5.0F, 0.1F, false);
public static ModeSetting rotationType = new ModeSetting("Режим ротации", "Adapted", "Adapted", "Polar", "Snap", "TriggerBot");
public static ModeSetting snapSetting = new ModeSetting("Режим снапа", "Fast", "Fast", "Smooth", "Random").hidden(() -> !rotationType.is("Snap"));
public static MultiBooleanSetting targets = new MultiBooleanSetting(
"Цели", new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", true)
);
public static ModeSetting attackDelay = new ModeSetting("Тайминг удара", "Быстрый", "Быстрый", "Динамичный");
public static MultiBooleanSetting misc = new MultiBooleanSetting(
"Проверки до удара",
new BooleanSetting("Бить через блоки", false),
new BooleanSetting("Бить только оружием", false),
new BooleanSetting("Не бить если кушаеш", true),
new BooleanSetting("Не атакавать в контейнере", false),
new BooleanSetting("Автоматичиски ломать щит", false),
new BooleanSetting("Отжимать щит при ударе", false)
);
public static MultiBooleanSetting extraSettings = new MultiBooleanSetting(
"Доп.настройка", new BooleanSetting("Легитный спринт", false), new BooleanSetting("Умные криты", false)
);
public static ModeSetting motion = new ModeSetting("Режим движения", "Default", "Default", "Free", "Target");
public static LivingEntity target;
public static boolean canSwap = false;
public static long lastLookUpTime = 0L;
public static long nextLookUpDelay = ThreadLocalRandom.current().nextLong(90000L, 180000L);
public static boolean isLookingUp = false;
public static long lookUpStartTime = 0L;
public static int lookUpDuration = 0;
public HitAura() {
this.addSettings(new Setting[]{attackRange, preRange, rotationType, snapSetting, targets, attackDelay, misc, extraSettings, motion});
}
@EventInit
public void onEvent(ClientTickEvent e) {
if (target != null && mc.player != null && mc.world != null) {
this.updateRotation();
}
}
@EventInit
public void onEvent(EventUpdate e) {
if (!mc.player.isAlive()) {
this.toggle();
} else {
if (target == null || !this.isValidTarget(target)) {
this.updateTarget();
}
if (target != null && mc.player != null && mc.world != null) {
if (motion.is("Free") && !canSwap) {
MoveUtil.fixMovement(mc.gameRenderer.getCamera().getYaw());
}
if (motion.is("Target") && !canSwap) {
MoveUtil.targetMovement(mc.player.getYaw(), target.getPos());
}
if (Attack.resetSprintTick(target, getRanges())) {
mc.player.setSprinting(false);
mc.options.sprintKey.setPressed(false);
}
if (!this.checkToAttack()) {
this.attackEntity();
}
} else {
this.reset();
}
}
}
public static float[] getRanges() {
return new float[]{attackRange.get(), preRange.get()};
}
public boolean isRayCastRuleToAttack() {
return true;
}
public void attackEntity() {
if (!(AuraUtil.getStrictDistance(target) >= attackRange.get())) {
float[] ranges = getRanges();
ranges = new float[]{ranges[0], ranges[1], ranges[0] + ranges[1]};
boolean canPacket = !mc.player.hasStatusEffect(StatusEffects.BLINDNESS) && !mc.player.isFlyingVehicle() && !extraSettings.get("Легитный спринт");
if (target != null) {
Attack.antiMissesHittingUpdate(target, true, this.isRayCastRuleToAttack(), false);
boolean canAttack = Attack.shouldAttack(target, this.isRayCastRuleToAttack(), true, true, 0L, ranges);
if (canAttack) {
Runnable[] shieldBreak = Attack.hitShieldBreakTaskForUse(target, misc.get("Автоматичиски ломать щит"));
Runnable[] shieldPressBypass = Attack.resetShieldSilentTaskForUse(true);
Runnable[] skipSilentSprint = Attack.skipSilentSprintingTaskForUse(canPacket);
Runnable preHitSendCodeSingleTick = () -> {
skipSilentSprint[0].run();
shieldPressBypass[0].run();
shieldBreak[0].run();
};
Runnable postHitSendCodeSingleTick = () -> {
shieldBreak[1].run();
shieldPressBypass[1].run();
skipSilentSprint[1].run();
};
if (misc.get("Отжимать щит при ударе") && mc.player.getActiveItem().getItem().equals(Items.SHIELD) && mc.player.isUsingItem()
)
{
mc.interactionManager.stopUsingItem(mc.player);
}
mc.player.setSprinting(false);
mc.options.sprintKey.setPressed(false);
Attack.useEntity(target, preHitSendCodeSingleTick, postHitSendCodeSingleTick, Hand.MAIN_HAND, true);
}
}
}
}
private void updateRotation() {
float[] ranges = getRanges();
ranges = new float[]{ranges[0], ranges[1], ranges[0] + ranges[1]};
boolean canAttack = Attack.shouldAttack(target, false, true, true, 0L, ranges);
String var3 = rotationType.get();
switch (var3) {
case "Polar":
UFunTimeRotations.rotation(target, Attack.shouldAttack(target, false, true, true, -50L, ranges), attackRange.get(), this.checkToAttack());
break;
case "Adapted":
if (PlayerUtil.isServerContains("spookytime")) {
Rotate.onSpookyRotation(target, canAttack);
} else if (PlayerUtil.isServerContains("holy")) {
Rotate.onHolyRotation(target, canAttack);
} else if (PlayerUtil.isServerContains("ares")) {
Rotate.onAresRotation(target, canAttack);
} else {
Rotate.onMatrixRotation(target, canAttack);
}
break;
case "Snap":
Rotate.onSnapRotation(target, Attack.shouldAttack(target, false, true, true, -50L, ranges), snapSetting.get());
}
}
private void updateTarget() {
LivingEntity bestTarget = null;
double bestAngle = Double.MAX_VALUE;
Vec3d eyePos = mc.player.getEyePos();
Vec3d lookVec = mc.player.getRotationVec(1.0F).normalize();
for (Entity entity : mc.world.getEntities()) {
if (entity instanceof LivingEntity living && this.isValidTarget(living)) {
Vec3d targetPos = living.getPos().add(0.0, living.getHeight() * 0.5, 0.0);
Vec3d toTarget = targetPos.subtract(eyePos).normalize();
double angle = Math.acos(MathHelper.clamp(lookVec.dotProduct(toTarget), -1.0, 1.0));
if (angle < bestAngle) {
bestAngle = angle;
bestTarget = living;
}
}
}
target = bestTarget;
}
private float auraDist() {
return attackRange.get() + preRange.get();
}
private boolean isValidTarget(LivingEntity entity) {
if (entity instanceof ClientPlayerEntity) {
return false;
} else if (mc.player.distanceTo(entity) > this.auraDist()) {
return false;
} else if (!misc.get("Бить через блоки") && !mc.player.canSee(entity)) {
return false;
} else if (entity instanceof PlayerEntity p && Night.get.friendManager.isFriend(p.getName().getString())) {
return false;
} else if (entity instanceof PlayerEntity && !targets.get("Игроки")) {
return false;
} else if (entity instanceof PlayerEntity && entity.getArmor() == 0 && !targets.get("Голые")) {
return false;
} else if (entity instanceof PlayerEntity && ((PlayerEntity)entity).isCreative()) {
return false;
} else {
return (entity instanceof Monster || entity instanceof SlimeEntity || entity instanceof VillagerEntity || entity instanceof AnimalEntity)
&& !targets.get("Мобы")
? false
: !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
}
}
@Override
public void toggle() {
super.toggle();
this.reset();
}
private void reset() {
target = null;
MovementManager.getInstance().unlockMovement("Aura");
if (mc.player != null) {
isLookingUp = false;
lookUpStartTime = 0L;
}
}
private boolean checkToAttack() {
return mc.player.isUsingItem() && misc.get("Не бить если кушаеш") && !(mc.player.getActiveItem().getItem() instanceof ShieldItem)
|| mc.currentScreen != null && misc.get("Не атакавать в контейнере")
|| !mc.player.getMainHandStack().isIn(ItemTags.SWORDS)
&& !mc.player.getMainHandStack().isIn(ItemTags.AXES)
&& misc.get("Бить только оружием");
}
@Override
public void onDisable() {
super.onDisable();
}
}
Код:
package ru.night.module.impl.combat.auraProcess;
import java.security.SecureRandom;
import java.util.Arrays;
import java.util.concurrent.ThreadLocalRandom;
import lombok.Generated;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.util.Hand;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AxeItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.world.World;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.client.MinecraftClient;
import net.minecraft.registry.tag.FluidTags;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.RaycastContext;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket.Mode;
import net.minecraft.world.RaycastContext.FluidHandling;
import net.minecraft.world.RaycastContext.ShapeType;
import ru.night.module.impl.combat.HitAura;
import ru.night.module.impl.combat.auraProcess.auraUtil.AuraUtil;
import ru.night.module.impl.combat.auraProcess.auraUtil.RayTraceUtil;
import ru.night.util.other.IMinecraft;
import ru.night.util.other.StopWatch;
@Environment(EnvType.CLIENT)
public final class Attack implements IMinecraft {
private static final SecureRandom secureRandom = new SecureRandom();
private static final MinecraftClient mc = MinecraftClient.getInstance();
public static long hitCounterCPSBypass;
public static int randomInt1PosibleOrNotOnHit = -1;
private static final StopWatch cooldownTimer = new StopWatch();
private static boolean missDetected;
private static int counterTo0PostMissHits;
public static void hitCounterCPSBypassNext() {
hitCounterCPSBypass++;
}
public static void hitCounterCPSBypassReset() {
hitCounterCPSBypass = 0L;
}
public static boolean cpsBypassTrigger() {
return hitCounterCPSBypass % 7L == 3L;
}
public static PlayerEntity getSelf() {
return mc.player;
}
public static World getWorld() {
return mc.world;
}
public static float applyGaussianJitter(float rotation) {
float strength = 0.2F;
return (float)(rotation + (secureRandom.nextGaussian() * 0.2F * 2.0 - 0.2F));
}
public static boolean randomBoolean(int chance010) {
return secureRandom.nextInt(chance010 + 1) >= 1.0F * (1.0F / Math.max((float)chance010, 1.0F));
}
public static boolean randomBoolean() {
return secureRandom.nextInt(2) == 1;
}
public static float randomFloat(float min, float max) {
return secureRandom.nextFloat(min, max);
}
public static float randomFloat() {
return randomFloat(0.0F, 1.0F);
}
public static int randomInt1PosibleOrNot() {
return randomBoolean() ? 1 : -1;
}
public static int getAxeSlot() {
if (mc.player == null) {
return -1;
} else {
for (int i = 0; i < 9; i++) {
if (mc.player.getInventory().getStack(i).getItem() instanceof AxeItem) {
return i;
}
}
return -1;
}
}
public static Runnable[] hitShieldBreakTaskForUse(LivingEntity livingIn, boolean enabled) {
Runnable[] pre$post = new Runnable[]{() -> {}, () -> {}};
if (enabled && mc.player != null) {
if (livingIn instanceof PlayerEntity player) {
if (!player.isBlocking()) {
return pre$post;
}
ItemStack main = player.getMainHandStack();
ItemStack off = player.getOffHandStack();
Item mainItem = main.isEmpty() ? null : main.getItem();
Item offItem = off.isEmpty() ? null : off.getItem();
if (mainItem == Items.SHIELD || offItem == Items.SHIELD) {
int handSlot = mc.player.getInventory().getSelectedSlot();
int slot;
if ((slot = getAxeSlot()) != -1 && slot != handSlot) {
pre$post[0] = () -> {
if (mc.getNetworkHandler() != null) {
mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(slot));
}
};
pre$post[1] = () -> {
if (mc.getNetworkHandler() != null) {
mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(handSlot));
}
};
}
}
}
return pre$post;
} else {
return pre$post;
}
}
public static Runnable[] resetShieldSilentTaskForUse(boolean enabled) {
Runnable[] pre$post = new Runnable[]{() -> {}, () -> {}};
if (enabled && mc.player != null) {
if (mc.player.isBlocking()) {
Hand active = mc.player.getActiveHand();
if (active == null) {
return pre$post;
}
pre$post[0] = () -> mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Direction.DOWN));
pre$post[1] = () -> mc.getNetworkHandler().sendPacket(new PlayerInteractItemC2SPacket(active, 0, mc.player.getYaw(), mc.player.getPitch()));
}
return pre$post;
} else {
return pre$post;
}
}
public static Runnable[] skipSilentSprintingTaskForUse(boolean enabled) {
Runnable[] pre$post = new Runnable[]{() -> {}, () -> {}};
if (enabled && mc.player != null) {
if (mc.player.isSprinting() && !mc.player.isOnGround() && !mc.player.isSubmergedIn(FluidTags.WATER)) {
pre$post[0] = () -> {
mc.player.setSprinting(false);
mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, Mode.STOP_SPRINTING));
};
pre$post[1] = () -> {
mc.player.setSprinting(true);
mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, Mode.START_SPRINTING));
};
}
return pre$post;
} else {
return pre$post;
}
}
public static double getYCapacityOnPlayerPos(int rangeY) {
if (mc.world != null && mc.player != null) {
Vec3d eyePos = mc.player.getEyePos();
double minDst = rangeY * 2.0;
double maxY = 320.0;
double minY = -64.0;
float selfWD2 = mc.player.getWidth() / 2.0F - 0.01F;
for (Vec3d vec : Arrays.asList(
eyePos.add(-selfWD2, 0.0, -selfWD2),
eyePos.add(selfWD2, 0.0, selfWD2),
eyePos.add(selfWD2, 0.0, -selfWD2),
eyePos.add(-selfWD2, 0.0, selfWD2)
)) {
HitResult first = mc.world
.raycast(new RaycastContext(vec, vec.add(0.0, -rangeY, 0.0), ShapeType.VISUAL, FluidHandling.ANY, mc.player));
HitResult second = mc.world
.raycast(new RaycastContext(vec, vec.add(0.0, rangeY, 0.0), ShapeType.VISUAL, FluidHandling.ANY, mc.player));
if (maxY > second.getPos().y) {
maxY = second.getPos().y;
}
if (minY < first.getPos().y) {
minY = first.getPos().y;
}
double dst = maxY - minY;
if (minDst > dst) {
minDst = dst;
}
}
return minDst - mc.player.getHeight();
} else {
return 1.0;
}
}
public static double convenientFallOffset() {
if (mc.player == null) {
return 0.0;
} else {
double fallOffset = mc.player.fallDistance;
if (mc.world != null && !mc.player.isOnGround() && mc.player.getVelocity().y < -0.0784000015258789) {
boolean posLiquid = !mc.world.getFluidState(mc.player.getBlockPos()).isEmpty();
boolean posUpLiquid = !mc.world.getFluidState(mc.player.getBlockPos().up()).isEmpty();
if (!posLiquid && !posUpLiquid && mc.player.fallDistance < -mc.player.getVelocity().y && mc.player.age > 6) {
fallOffset = -mc.player.getVelocity().y;
}
}
return fallOffset;
}
}
public static boolean isBestMomentToHit(boolean fallCheck) {
if (fallCheck && mc.player != null) {
float adaptiveFallValue = 0.0F;
float maxFallOff = 0.2F;
if (cpsBypassTrigger() && getYCapacityOnPlayerPos(2) > 0.20000005F) {
adaptiveFallValue = maxFallOff;
}
boolean hasFall = convenientFallOffset() > adaptiveFallValue || getYCapacityOnPlayerPos(2) < 0.1F;
if (hasFall) {
return true;
} else {
boolean isInWeb = mc.world.getBlockState(mc.player.getBlockPos()).isOf(Blocks.COBWEB);
boolean badLiquidMoment = !mc.player.isJumping() && (mc.player.isTouchingWater() || mc.player.isInLava())
|| mc.player.isSubmergedIn(FluidTags.WATER)
|| mc.player.isSubmergedIn(FluidTags.LAVA)
|| isInWeb;
return badLiquidMoment
|| !mc.player.isJumping() && mc.player.age > 6 && HitAura.extraSettings.get("Умные криты")
|| mc.player.isClimbing()
|| mc.player.hasVehicle()
|| mc.player.hasStatusEffect(StatusEffects.BLINDNESS)
|| mc.player.hasStatusEffect(StatusEffects.LEVITATION)
|| mc.player.hasStatusEffect(StatusEffects.SLOW_FALLING)
|| mc.player.getAbilities().flying;
}
} else {
return true;
}
}
public static boolean useEntity(LivingEntity livingIn, Runnable preHit, Runnable postHit, Hand hand, boolean cpsBypass) {
if (preHit != null) {
preHit.run();
}
if (livingIn != null && mc.interactionManager != null && mc.player != null) {
mc.interactionManager.attackEntity(mc.player, livingIn);
if (hand != null) {
mc.player.swingHand(hand);
}
if (cpsBypass) {
hitCounterCPSBypassNext();
} else {
hitCounterCPSBypassReset();
}
cooldownTimer.reset();
}
if (postHit != null) {
postHit.run();
}
return livingIn != null;
}
public static long getMsCooldown() {
if (mc.player == null) {
return 500L;
} else {
double attackSpeed = mc.player.getAttributeValue(EntityAttributes.ATTACK_SPEED);
float maxDeviation = 0.2F;
long msCooldown2 = (long)(1.0 / attackSpeed * 1000.0 * (1.0F - Math.min(maxDeviation, 1.0F)));
long msCooldown;
if (HitAura.attackDelay.is("Динамичный")) {
msCooldown = msCooldown2 + ThreadLocalRandom.current().nextLong(10L, 50L);
} else {
msCooldown = msCooldown2 + 40L;
}
return msCooldown;
}
}
public static boolean msCooldownReached(long msOffset) {
return cooldownTimer.finished(getMsCooldown() + msOffset);
}
public static boolean msCooldownReached() {
return msCooldownReached(0L);
}
public static boolean msCooldownHasMs(long ms) {
return cooldownTimer.finished(ms);
}
public static float msCooldownPC01() {
return Math.min((float)cooldownTimer.elapsedTime() / (float)getMsCooldown(), 1.0F);
}
public static float msCooldownReach() {
return (float)cooldownTimer.elapsedTime();
}
public static boolean anyEntityOnRay(LivingEntity livingIn, double range) {
return livingIn != null
&& RayTraceUtil.rayTraceEntity(MathHelper.wrapDegrees(mc.player.getYaw()), mc.player.getPitch(), (float)range, livingIn);
}
public static boolean shouldAttack(LivingEntity livingTarget, boolean rayCast, boolean distanceCheck, boolean fallCheck, long cooldownMSOffset, float[] ranges) {
if (distanceCheck && livingTarget != null && !AuraUtil.validDistance(livingTarget, ranges[0], true)) {
return false;
} else if (!msCooldownReached(cooldownMSOffset)) {
return false;
} else {
boolean validNext = isBestMomentToHit(fallCheck);
if (validNext && rayCast && !anyEntityOnRay(livingTarget, ranges[0])) {
validNext = false;
}
return validNext;
}
}
public static boolean shouldAttack(LivingEntity livingTarget, boolean rayCast, boolean fallCheck, long cooldownMSOffset, float[] ranges) {
return shouldAttack(livingTarget, rayCast, true, fallCheck, cooldownMSOffset, ranges);
}
public static boolean resetSprintTickP(LivingEntity targetIn, float[] ranges) {
return targetIn != null
&& shouldAttack(targetIn, false, false, -80L, ranges)
&& !mc.player.isOnGround()
&& !mc.player.isSubmergedIn(FluidTags.WATER)
&& mc.player.getVelocity().y <= 0.0030162615090425808;
}
public static boolean resetSprintTick(LivingEntity targetIn, float[] ranges) {
return targetIn != null
&& shouldAttack(targetIn, false, false, -60L, ranges)
&& !mc.player.isOnGround()
&& !mc.player.isSubmergedIn(FluidTags.WATER)
&& mc.player.getVelocity().y <= 0.16477328182606651;
}
private static int maxHitsCountOnMiss() {
return 3;
}
public static void antiMissesHittingReset() {
missDetected = false;
counterTo0PostMissHits = 0;
}
public static void antiMissesHittingUpdate(LivingEntity targetIn, boolean cpsBypass, boolean rayCastCheck, boolean enabled) {
if (targetIn == null || counterTo0PostMissHits == 0 || !enabled || targetIn.hurtTime != 0) {
antiMissesHittingReset();
}
if (enabled && targetIn != null && msCooldownHasMs(cpsBypassTrigger() ? 250L : 150L) && mc.player.handSwinging) {
if (!missDetected && counterTo0PostMissHits == 0 && targetIn.hurtTime == 0) {
missDetected = true;
counterTo0PostMissHits = maxHitsCountOnMiss();
}
if (missDetected
&& counterTo0PostMissHits > 0
&& targetIn != null
&& (!rayCastCheck || anyEntityOnRay(targetIn, 6.0))
&& useEntity(targetIn, () -> {}, () -> {}, Hand.MAIN_HAND, cpsBypass)) {
counterTo0PostMissHits--;
}
}
}
@Generated
private Attack() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
@Generated
public static StopWatch getCooldownTimer() {
return cooldownTimer;
}
}
Код:
package ru.night.module.impl.combat.auraProcess;
import java.util.concurrent.ThreadLocalRandom;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.MathHelper;
import ru.night.module.impl.combat.HitAura;
import ru.night.module.impl.combat.auraProcess.auraUtil.AuraUtil;
import ru.night.module.impl.combat.auraProcess.auraUtil.UBoxPoints;
import ru.night.module.impl.combat.auraProcess.rotationProcess.impl.FreeLookUtil;
import ru.night.module.impl.combat.auraProcess.rotationProcess.impl.Rotation;
import ru.night.module.impl.combat.auraProcess.rotationProcess.impl.RotationProcess;
import ru.night.util.other.IMinecraft;
import ru.night.util.other.Mathf;
@Environment(EnvType.CLIENT)
public class UFunTimeRotations implements IMinecraft {
static float tick;
static float lastAttackPitch = 0.0F;
public static void rotation(LivingEntity target, boolean isAttack, float attackDistance, boolean check) {
long currentTime = System.currentTimeMillis();
if (!HitAura.isLookingUp && currentTime - HitAura.lastLookUpTime >= HitAura.nextLookUpDelay) {
HitAura.isLookingUp = true;
HitAura.lookUpStartTime = currentTime;
HitAura.lookUpDuration = ThreadLocalRandom.current().nextInt(270, 390);
HitAura.lastLookUpTime = currentTime;
HitAura.nextLookUpDelay = ThreadLocalRandom.current().nextLong(10500L, 13200L);
}
boolean fastspeed = false;
if (HitAura.isLookingUp && currentTime - HitAura.lookUpStartTime >= HitAura.lookUpDuration) {
HitAura.isLookingUp = false;
}
if (currentTime - HitAura.lookUpStartTime >= HitAura.lookUpDuration + 60L) {
fastspeed = true;
}
Vec3d directionVec = UBoxPoints.getBestVector3dOnEntityBox(target.getBoundingBox()).subtract(mc.player.getEyePos());
float baseYaw = FreeLookUtil.freeYaw;
if (isAttack && AuraUtil.getStrictDistance(target) < attackDistance && !check) {
tick = Mathf.randomValue(6.0F, 7.0F);
}
float fov = (float)AuraUtil.calculateFOVFromCamera(target);
float baseFov = 360.0F;
float yawChangeSpeed = Mathf.randomValue(22.0F, 29.0F);
float randomAttackShift = 0.0F;
float pitchChangeSpeed = Mathf.randomValue(0.0F, 3.5F);
float waveA = (float)Math.cos(System.currentTimeMillis() / 40.0);
float waveB = (float)Math.sin(System.currentTimeMillis() / 70.0);
if (tick > 0.0F && Math.abs(fov) < baseFov) {
yawChangeSpeed = Mathf.randomValue(90.0F, 120.0F);
baseYaw = (float)Math.toDegrees(Math.atan2(-directionVec.x, directionVec.z));
randomAttackShift = (waveA + waveB) * Rotate.randomLerp(1.0F, 2.0F);
tick--;
}
float basePitch = (float)MathHelper.clamp(
-Math.toDegrees(Math.atan2(directionVec.y, Math.hypot(directionVec.x, directionVec.z))), -90.0, 90.0
);
float yawJitter = waveA * Rotate.randomLerp(11.0F, 14.0F) + randomAttackShift;
float pitchJitter = waveB * Rotate.randomLerp(4.0F, 7.0F) + randomAttackShift;
if (isAttack && AuraUtil.getStrictDistance(target) < attackDistance && !check) {
lastAttackPitch = basePitch;
}
float finalPitch = HitAura.isLookingUp ? -Mathf.randomValue(85.0F, 90.0F) : basePitch;
Rotation newRotation = new Rotation(baseYaw + yawJitter, finalPitch + pitchJitter);
RotationProcess.update(
newRotation,
yawChangeSpeed,
HitAura.isLookingUp ? Rotate.randomLerp(120.0F, 170.0F) : (fastspeed ? Rotate.randomLerp(120.0F, 170.0F) : Rotate.randomLerp(6.0F, 8.0F)),
25.0F,
25.0F,
0,
15,
false
);
}
}