Начинающий
-
Автор темы
- #1
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
До нового года 10 дней.
Код:
package dev.client.ModuleSystem.core.combat;
import com.google.common.eventbus.Subscribe;
import dev.client.BladeClient;
import dev.client.EventSystem.core.events.input.InputEvent;
import dev.client.EventSystem.core.events.input.MotionEvent;
import dev.client.EventSystem.core.events.network.UpdateEvent;
import dev.client.ModuleSystem.api.Module;
import dev.client.ModuleSystem.api.ModuleCategory;
import dev.client.ModuleSystem.api.ModuleRegister;
import dev.client.ModuleSystem.core.combat.killaura.AuraUtil;
import dev.client.ModuleSystem.core.player.AutoPotion;
import dev.client.ModuleSystem.moduleSettings.BooleanSetting;
import dev.client.ModuleSystem.moduleSettings.ModeSetting;
import dev.client.ModuleSystem.moduleSettings.MultiListSetting;
import dev.client.ModuleSystem.moduleSettings.SliderSetting;
import dev.client.UtilsSystem.client.singleton.Singleton;
import dev.client.UtilsSystem.math.core.MouseUtil;
import dev.client.UtilsSystem.math.sens.SensUtil;
import dev.client.UtilsSystem.math.timer.TimerUtil;
import dev.client.UtilsSystem.player.InventoryUtil;
import dev.client.UtilsSystem.player.movement.MoveUtil;
import lombok.Getter;
import net.minecraft.block.material.Material;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.item.ArmorStandEntity;
import net.minecraft.entity.merchant.villager.VillagerEntity;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.CEntityActionPacket;
import net.minecraft.network.play.client.CHeldItemChangePacket;
import net.minecraft.tags.FluidTags;
import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector2f;
import net.minecraft.util.math.vector.Vector3d;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import static java.lang.Math.hypot;
import static net.minecraft.util.math.MathHelper.wrapDegrees;
@Getter
@ModuleRegister(name = "KillAura", category = ModuleCategory.Combat)
public class KillAura extends Module {
public static Singleton<KillAura> singleton = Singleton.create(() -> Module.link(KillAura.class));
public final ModeSetting bypassTypeKillAura = new ModeSetting("Тип обхода", "Grim",
"Grim",
"FunTime",
"HvH"
).setParent(this);
public final SliderSetting attackRange = new SliderSetting("Дистанция аттаки",
3f, 3f, 6f, 0.1f
).setParent(this);
public final MultiListSetting typeFilter = new MultiListSetting("Фильтр на",
new BooleanSetting("Игроков", true),
new BooleanSetting("Мобов", false),
new BooleanSetting("Животных", false),
new BooleanSetting("Жителей", false),
new BooleanSetting("Друзей", true),
new BooleanSetting("Невидимых", true),
new BooleanSetting("Голых", true)
).setParent(this);
public final ModeSetting targetsSort = new ModeSetting("Сортировать по",
"Здоровью",
"Здоровью",
"Броне",
"Дистанции",
"Полю зрения",
"По всему"
).setParent(this);
public final BooleanSetting onlyCrits = new BooleanSetting("Только криты", true).setParent(this);
public final BooleanSetting shieldBreaker = new BooleanSetting("Ломать щит", true).setParent(this);
public final BooleanSetting otjimBreaker = new BooleanSetting("Отжимать щит", false).setParent(this);
public final BooleanSetting accelerateRotation = new BooleanSetting("Ускорять ротацию", false).setParent(this);
public final BooleanSetting tpsSync = new BooleanSetting("Синхронизация с тиками", true).setParent(this);
public final BooleanSetting targetFocus = new BooleanSetting("Фокусировать одну цель", false).setParent(this);
public final BooleanSetting wallsAttack = new BooleanSetting("Бить через стены", false).setParent(this);
public final BooleanSetting sprintReset = new BooleanSetting("Сбрасывать спринт", true).setParent(this);
public final BooleanSetting fov = new BooleanSetting("Ограничить Fov", true).setParent(this);
public final BooleanSetting correctionMovements = new BooleanSetting("Коррекция движения", true).setParent(this);
public final ModeSetting correctionType = new ModeSetting("Мод коррекции",
"Свободный",
"Свободный",
"Сфокусированный"
).setParent(this).setShown(() -> correctionMovements.get());
public final SliderSetting radiusFov = new SliderSetting("Фов",
90, 10, 180, 0.5f
).setParent(this).setShown(() -> fov.get());
public final MultiListSetting noAttackCheck = new MultiListSetting("Не бить если",
new BooleanSetting("Открыт инвентарь", true),
new BooleanSetting("Используешь еду", true)
).setParent(this);
private final TimerUtil timerUtil = new TimerUtil();
private final TimerUtil focusTimer = new TimerUtil();
private Vector2f rotateVector = new Vector2f(0, 0);
private LivingEntity target;
private Entity selected;
protected float lastYaw, lastPitch;
private int ticks = 0;
@Subscribe
public void onInput(InputEvent userInputEvent) {
if (correctionMovements.get() && correctionType.get("Свободный") && target != null && mc.player != null) {
MoveUtil.fixMovement(userInputEvent, rotateVector.x);
}
}
@Subscribe
public void onUpdate(UpdateEvent e) {
updateTarget();
if (target != null && !isAutoPotionActive()) {
processRotationLogic();
} else {
timerUtil.setLastMS(0);
reset();
}
}
@Subscribe
public void onWalking(MotionEvent e) {
if (target == null || isAutoPotionActive()) return;
setPlayerRotation(e);
}
private boolean isAutoPotionActive() {
return AutoPotion.singleton.get().isEnabled() && AutoPotion.singleton.get().isActive();
}
private void processRotationLogic() {
if (target == null || mc.player.getDistance(target) > attackRange.get()) {
updateTarget();
}
boolean isInventoryOpen = noAttackCheck.get("Открыт инвентарь").get() && mc.currentScreen instanceof InventoryScreen;
boolean isUsingFood = noAttackCheck.get("Используешь еду").get() && mc.player.isHandActive() && mc.player.getActiveItemStack().getItem().isFood();
if (isInventoryOpen || isUsingFood) {
rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
return;
}
if (shouldPlayerFalling() && timerUtil.hasTimeElapsed()) {
updateAttack();
ticks = 1;
}
if (bypassTypeKillAura.get("Grim")) {
handleGrimRotation();
} else if (bypassTypeKillAura.get("FunTime")) {
handleFunTimeRotation();
} else if (bypassTypeKillAura.get("HvH")) {
handleHvHRotation();
}
}
private void handleGrimRotation() {
if (ticks > 0) {
updateRotation(true, 120, 70);
ticks--;
} else {
reset();
}
}
private void handleFunTimeRotation() {
if (ticks > 0) {
updateRotation(true, 120, 90);
ticks--;
} else {
reset();
}
}
private void handleHvHRotation() {
updateRotation(true, 150, 150);
}
private void setPlayerRotation(MotionEvent e) {
if (rotateVector == null) return;
float yaw = rotateVector.x;
float pitch = rotateVector.y;
e.setYaw(yaw);
e.setPitch(pitch);
mc.player.rotationYawHead = yaw;
mc.player.renderYawOffset = yaw;
mc.player.rotationPitchHead = pitch;
}
private void updateTarget() {
List<LivingEntity> targets = new ArrayList<>();
for (Entity entity : mc.world.getAllEntities()) {
if (entity instanceof LivingEntity living && isValid(living)) {
targets.add(living);
}
}
if (targetFocus.get() && target != null) {
if (isValid(target)) {
if (!focusTimer.isReached(5000)) {
return;
} else {
focusTimer.reset();
target = null;
}
} else {
focusTimer.reset();
target = null;
}
}
if (targets.isEmpty()) {
target = null;
return;
}
sortTargets(targets);
target = targets.get(0);
focusTimer.reset();
}
private void sortTargets(List<LivingEntity> targets) {
Comparator<LivingEntity> comparator = (object1, object2) -> 0;
if (targetsSort.get("Здоровью")) {
comparator = Comparator.comparingDouble(this::getEntityHealth).reversed();
}
if (targetsSort.get("Броне")) {
comparator = comparator.thenComparing(Comparator.comparingDouble(o -> getEntityArmor((PlayerEntity) o)).reversed());
}
if (targetsSort.get("Дистанции")) {
comparator = comparator.thenComparingDouble(mc.player::getDistance);
}
if (targetsSort.get("Полю зрения")) {
comparator = comparator.thenComparingDouble(this::getFieldOfView).reversed();
}
if (targetsSort.get("По всему")) {
comparator = Comparator.comparingDouble((LivingEntity o) -> mc.player.getDistance(o))
.thenComparingDouble(this::getFieldOfView)
.thenComparingDouble(this::getEntityHealth)
.thenComparingDouble(o -> getEntityArmor((PlayerEntity) o));
}
targets.sort(comparator);
}
private double getFieldOfView(LivingEntity entity) {
Vector3d playerVec = mc.player.getLookVec();
Vector3d targetVec = entity.getPositionVec().subtract(mc.player.getPositionVec()).normalize();
double dotProduct = playerVec.dotProduct(targetVec);
return Math.acos(dotProduct) * (180 / Math.PI);
}
private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
if (target == null || mc.player == null) return;
Vector3d vec = calculateTargetVector();
float yawToTarget = calculateYawToTarget(vec);
float pitchToTarget = calculatePitchToTarget(vec);
float yawDelta = wrapDegrees(yawToTarget - rotateVector.x);
float pitchDelta = wrapDegrees(pitchToTarget - rotateVector.y);
float clampedYaw = Math.min(Math.abs(yawDelta), rotationYawSpeed);
float clampedPitch = Math.min(Math.abs(pitchDelta), rotationPitchSpeed);
switch (bypassTypeKillAura.get()) {
case "Grim" -> applyGrimRotation(attack, yawDelta, pitchDelta, clampedYaw, clampedPitch);
case "FunTime" -> applyFunTimeRotation(attack, yawDelta, pitchDelta, clampedYaw, clampedPitch);
case "HvH" -> applyHvHRotation(attack, yawDelta, pitchDelta);
}
}
private Vector3d calculateTargetVector() {
Vector3d closestPoint = AuraUtil.getClosestVec(target);
return closestPoint.subtract(mc.player.getEyePosition(mc.getRenderPartialTicks())).normalize();
}
private float calculateYawToTarget(Vector3d vec) {
return (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90);
}
private float calculatePitchToTarget(Vector3d vec) {
return (float) (-Math.toDegrees(Math.atan2(vec.y, hypot(vec.x, vec.z))));
}
private void applyGrimRotation(boolean attack, float yawDelta, float pitchDelta, float clampedYaw, float clampedPitch) {
if (attack && selected != target && accelerateRotation.get()) {
clampedPitch = Math.max(Math.abs(pitchDelta), 3f);
clampedYaw = Math.max(Math.abs(yawDelta), 3f);
}
clampedYaw = SensUtil.applyMinimalThreshold(clampedYaw, 0.1f);
clampedPitch = SensUtil.applyMinimalThreshold(clampedPitch, 0.1f);
Vector2f correctedRotation = SensUtil.applySensitivityFix(
new Vector2f(rotateVector.x + (yawDelta > 0 ? clampedYaw : -clampedYaw),
rotateVector.y + (pitchDelta > 0 ? clampedPitch : -clampedPitch)),
new Vector2f(rotateVector.x, rotateVector.y)
);
rotateVector = new Vector2f(
correctedRotation.x,
Math.max(-89.0f, Math.min(89.0f, correctedRotation.y))
);
lastYaw = clampedYaw;
lastPitch = clampedPitch;
if (correctionMovements.get()) {
mc.player.rotationYawOffset = rotateVector.x;
}
}
private void applyFunTimeRotation(boolean attack, float yawDelta, float pitchDelta, float clampedYaw, float clampedPitch) {
if (target == null || mc.player == null || (!LookTarget(target) && fov.get())) {
return;
}
float yawDeltaAbs = Math.abs(yawDelta);
float pitchDeltaAbs = Math.abs(pitchDelta);
float yawSpeedMultiplier = yawDeltaAbs > 90.0f ? 0.8f : yawDeltaAbs > 45.0f ? 0.6f : 0.4f;
float pitchSpeedMultiplier = pitchDeltaAbs > 45.0f ? 0.6f : 0.4f;
float maxYawStep = clampedYaw * yawSpeedMultiplier;
float maxPitchStep = clampedPitch * pitchSpeedMultiplier;
float yawChange = yawDelta > 0 ? Math.min(maxYawStep, yawDelta) : Math.max(-maxYawStep, yawDelta);
float pitchChange = pitchDelta > 0 ? Math.min(maxPitchStep, pitchDelta) : Math.max(-maxPitchStep, pitchDelta);
Vector2f correctedRotation = SensUtil.applySensitivityFix(
new Vector2f(rotateVector.x + yawChange, rotateVector.y + pitchChange),
new Vector2f(rotateVector.x, rotateVector.y)
);
rotateVector = new Vector2f(
correctedRotation.x,
Math.max(-89.0f, Math.min(89.0f, correctedRotation.y))
);
if (fov.get()) {
float dynamicFoV = Math.max(30.0f, radiusFov.get() - mc.player.getDistance(target) * 4.0f);
if (yawDeltaAbs > dynamicFoV || pitchDeltaAbs > (dynamicFoV / 2)) {
rotateVector = new Vector2f(mc.player.rotationYaw, mc.player.rotationPitch);
}
}
if (correctionMovements.get()) {
mc.player.rotationYawOffset = rotateVector.x;
}
}
private void applyHvHRotation(boolean attack, float yawDelta, float pitchDelta) {
if (target == null || mc.player == null) return;
rotateVector = new Vector2f(
rotateVector.x + yawDelta,
rotateVector.y + pitchDelta
);
lastYaw = Math.abs(yawDelta);
lastPitch = Math.abs(pitchDelta);
if (correctionMovements.get()) {
mc.player.rotationYawOffset = rotateVector.x;
}
}
private boolean LookTarget(LivingEntity target) {
if (target == null) return false;
Vector3d playerDirection = mc.player.getLook(1.0F).normalize();
Vector3d targetDirection = target.getPositionVec()
.subtract(mc.player.getEyePosition(1.0F))
.normalize();
double dotProduct = playerDirection.dotProduct(targetDirection);
double angle = Math.toDegrees(Math.acos(MathHelper.clamp(dotProduct, -1.0, 1.0)));
double maxFov = fov.get() ? radiusFov.get() : 360.0;
return angle <= maxFov || !fov.get();
}
private final TimerUtil sprintTimer = new TimerUtil();
private void resetSprintDirectly() {
if (sprintReset.get() && mc.player.isSprinting()) {
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING));
mc.player.setSprinting(false);
}
if (sprintReset.get() && !mc.player.isSprinting() && mc.gameSettings.keyBindForward.isKeyDown()) {
mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING));
mc.player.setSprinting(true);
}
}
private void updateAttack() {
if (target == null) return;
selected = MouseUtil.getMouseOver(target, rotateVector.x, rotateVector.y, attackRange.get());
boolean isInventoryOpen = noAttackCheck.get("Открыт инвентарь").get() && mc.currentScreen instanceof InventoryScreen;
boolean isUsingFood = noAttackCheck.get("Используешь еду").get() && mc.player.isHandActive() && mc.player.getActiveItemStack().getItem().isFood();
if (isInventoryOpen || isUsingFood) {
return;
}
resetSprintDirectly();
if (otjimBreaker.get() && target instanceof PlayerEntity player) {
if (player.isBlocking()) {
performShieldBreak(player);
return;
}
}
if (accelerateRotation.get()) {
if (bypassTypeKillAura.get("Grim")) {
updateRotation(true, 150, 90);
} else if (bypassTypeKillAura.get("FunTime")) {
updateRotation(true, 150, 120);
} else if (bypassTypeKillAura.get("HvH")) {
updateRotation(true, 200, 200);
}
}
if (!mc.player.isElytraFlying() && (selected == null || selected != target)) {
return;
}
timerUtil.setLastMS(500);
mc.playerController.attackEntity(mc.player, target);
mc.player.swingArm(Hand.MAIN_HAND);
if (target instanceof PlayerEntity player && shieldBreaker.get()) {
breakShieldPlayer(player);
}
}
private void performShieldBreak(PlayerEntity targetPlayer) {
int axeSlot = InventoryUtil.getInstance().getAxeInInventory(true);
if (axeSlot == -1) return;
mc.player.connection.sendPacket(new CHeldItemChangePacket(axeSlot));
mc.playerController.attackEntity(mc.player, targetPlayer);
mc.player.swingArm(Hand.MAIN_HAND);
mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
}
public boolean shouldPlayerFalling() {
boolean cancelReason = mc.player.isInWater() && mc.player.areEyesInFluid(FluidTags.WATER)
|| mc.player.isInLava() && mc.player.areEyesInFluid(FluidTags.LAVA)
|| mc.player.isOnLadder()
|| mc.world.getBlockState(mc.player.getPosition()).getMaterial() == Material.WEB
|| mc.player.abilities.isFlying;
float adjustTicks = tpsSync.get() ? BladeClient.getInstance().getServerUtils().getAdjustTicks() : 1.5F;
if (mc.player.getCooledAttackStrength(adjustTicks) < 0.92F) {
return false;
}
if (!cancelReason && onlyCrits.get()) {
return !mc.player.isOnGround() && mc.player.fallDistance > 0;
}
return true;
}
private boolean isValid(LivingEntity entity) {
if (entity instanceof ClientPlayerEntity) return false;
if (entity.ticksExisted < 3) return false;
if (AuraUtil.getDistanceEyePos(entity) > attackRange.get()) return false;
if (!wallsAttack.get() && !mc.player.canEntityBeSeen(entity)) {
return false;
}
if (entity instanceof PlayerEntity p) {
if (AntiBot.isBot(entity)) return false;
if (!typeFilter.get("Друзей").get() && BladeClient.getInstance().getFriendManager().isFriend(p.getName().getString())) {
return false;
}
if (p.getName().getString().equalsIgnoreCase(mc.player.getName().getString())) return false;
if (!typeFilter.get("Игроков").get()) {
return false;
}
if (p.getTotalArmorValue() == 0 && !typeFilter.get("Голых").get()) {
return false;
}
if (p.isInvisible()) {
if (!typeFilter.get("Невидимых").get()) {
return false;
}
if (p.getTotalArmorValue() == 0 && !typeFilter.get("Голых").get()) {
return false;
}
}
}
if (entity instanceof MonsterEntity) {
if (!typeFilter.get("Мобов").get()) {
return false;
}
}
if (entity instanceof AnimalEntity) {
if (!typeFilter.get("Животных").get()) {
return false;
}
}
if (entity instanceof VillagerEntity) {
if (!typeFilter.get("Жителей").get()) {
return false;
}
}
return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
}
private void breakShieldPlayer(PlayerEntity entity) {
if (entity.isBlocking()) {
int invSlot = InventoryUtil.getInstance().getAxeInInventory(false);
int hotBarSlot = InventoryUtil.getInstance().getAxeInInventory(true);
if (hotBarSlot == -1 && invSlot != -1) {
int bestSlot = InventoryUtil.getInstance().findBestSlotInHotBar();
mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
mc.playerController.attackEntity(mc.player, entity);
mc.player.swingArm(Hand.MAIN_HAND);
mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, mc.player);
}
if (hotBarSlot != -1) {
mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
mc.playerController.attackEntity(mc.player, entity);
mc.player.swingArm(Hand.MAIN_HAND);
mc.player.connection.sendPacket(new CHeldItemChangePacket(mc.player.inventory.currentItem));
}
}
}
private void reset() {
if (mc.player != null && correctionMovements.get()) {
mc.player.rotationYawOffset = Integer.MIN_VALUE;
}
rotateVector = new Vector2f(mc.player != null ? mc.player.rotationYaw : 0, mc.player != null ? mc.player.rotationPitch : 0);
}
@Override
public void onEnabled() {
super.onEnabled();
if (mc.player != null) {
reset();
target = null;
}
}
@Override
public void onDisabled() {
super.onDisabled();
reset();
timerUtil.setLastMS(0);
target = null;
}
private double getEntityArmor(PlayerEntity entityPlayer2) {
double d2 = 0.0;
for (int i2 = 0; i2 < 4; ++i2) {
ItemStack is = entityPlayer2.inventory.armorInventory.get(i2);
if (!(is.getItem() instanceof ArmorItem)) continue;
d2 += getProtectionLvl(is);
}
return d2;
}
private double getProtectionLvl(ItemStack stack) {
if (stack.getItem() instanceof ArmorItem i) {
double damageReduceAmount = i.getDamageReduceAmount();
if (stack.isEnchanted()) {
damageReduceAmount += (double) EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
}
return damageReduceAmount;
}
return 0;
}
private double getEntityHealth(LivingEntity ent) {
if (ent instanceof PlayerEntity player) {
return (double) (player.getHealth() + player.getAbsorptionAmount()) * (getEntityArmor(player) / 20.0);
}
return ent.getHealth() + ent.getAbsorptionAmount();
}
public LivingEntity getTarget() {
return KillAura.singleton.get().isEnabled() ? KillAura.singleton.get().target : null;
}
}