-
Автор темы
- #1
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
Ну типо самый дефолтный элитра таргет, если доработать то думаю будет норм (есть 2 режима, легит и rage)
Код:
package xii.infinity.client.functions.impl.combat;
import com.google.common.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import xii.infinity.client.Infinity;
import xii.infinity.client.command.friends.FriendStorage;
import xii.infinity.client.events.EventInput;
import xii.infinity.client.events.EventMotion;
import xii.infinity.client.events.EventUpdate;
import xii.infinity.client.functions.api.Category;
import xii.infinity.client.functions.api.Function;
import xii.infinity.client.functions.api.FunctionRegister;
import xii.infinity.client.functions.settings.impl.BooleanSetting;
import xii.infinity.client.functions.settings.impl.ModeListSetting;
import xii.infinity.client.functions.settings.impl.ModeSetting;
import xii.infinity.client.functions.settings.impl.SliderSetting;
import xii.infinity.client.utils.math.SensUtils;
import xii.infinity.client.utils.math.StopWatch;
import xii.infinity.client.utils.player.InventoryUtil;
import xii.infinity.client.utils.player.MouseUtil;
import xii.infinity.client.utils.player.MoveUtils;
import net.minecraft.client.entity.player.ClientPlayerEntity;
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.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.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.clamp;
import static net.minecraft.util.math.MathHelper.wrapDegrees;
@FunctionRegister(name="KillAura", type=Category.Combat)
public class KillAura
extends Function {
private final ModeSetting type = new ModeSetting("Тип", "Плавная", "Плавная", "Резкая");
private final SliderSetting attackRange = new SliderSetting("Дистанция аттаки", 3.0f, 3.0f, 6.0f, 0.1f);
final ModeListSetting targets = new ModeListSetting("Таргеты", new BooleanSetting("Игроки", true), new BooleanSetting("Голые", true), new BooleanSetting("Мобы", false), new BooleanSetting("Животные", false), new BooleanSetting("Друзья", false), new BooleanSetting("Голые невидимки", true), new BooleanSetting("Невидимки", true));
final ModeListSetting options = new ModeListSetting("Опции", new BooleanSetting("Только криты", true), new BooleanSetting("Ломать щит", true), new BooleanSetting("Отжимать щит", true), new BooleanSetting("Ускорять ротацию при атаке", false), new BooleanSetting("Синхронизировать атаку с ТПС", false), new BooleanSetting("Фокусировать одну цель", true), new BooleanSetting("Коррекция движения", true));
final ModeSetting correctionType = new ModeSetting("Тип коррекции", "Незаметный", "Незаметный", "Сфокусированный").setVisible(() -> options.getValueByName("Коррекция движения").get());
private final StopWatch stopWatch = new StopWatch();
final BooleanSetting followTarget = new BooleanSetting("ElytraTarget", false);
private ModeSetting elytraTargetType = new ModeSetting("ElytraTargetType", "ElytraTarget | Legit", "ElytraTarget | Legit", "ElytraTarget | Rage").setVisible(() -> followTarget.get());
private final SliderSetting ggg = new SliderSetting("Скорость привязки", 1f, 1, 4, 0.1f).setVisible(() -> elytraTargetType.is("ElytraTarget | Rage"));
private Vector2f rotateVector = new Vector2f(0.0f, 0.0f);
private LivingEntity target;
private Entity selected;
int ticks = 0;
boolean isRotated;
final AutoPotion autoPotion;
private final SliderSetting newSliderSetting = new SliderSetting("Дистанция наводки", 15.0f, 3, 40, 0.5f).setVisible(() -> followTarget.get());
float lastYaw;
float lastPitch;
public KillAura(AutoPotion autoPotion) {
this.autoPotion = autoPotion;
this.addSettings(this.type, this.attackRange, this.targets, this.options, this.correctionType,this.followTarget,this.elytraTargetType,this.newSliderSetting,this.ggg);
}
@Subscribe
public void onInput(EventInput eventInput) {
if (((Boolean)this.options.getValueByName("Коррекция движения").get()).booleanValue() && this.correctionType.is("Незаметная") && this.target != null && KillAura.mc.player != null) {
MoveUtils.fixMovement(eventInput, this.rotateVector.x);
}
}
@Subscribe
public void onUpdate(EventUpdate e) {
if (((Boolean)this.options.getValueByName("Фокусировать одну цель").get()).booleanValue() && (this.target == null || !this.isValid(this.target)) || !((Boolean)this.options.getValueByName("Фокусировать одну цель").get()).booleanValue()) {
this.updateTarget();
}
if (!(this.target == null || this.autoPotion.isState() && this.autoPotion.isActive())) {
this.isRotated = false;
if (this.shouldPlayerFalling() && this.stopWatch.hasTimeElapsed()) {
this.updateAttack();
this.ticks = 2;
}
if (this.type.is("Резкая")) {
if (this.ticks > 0) {
this.updateRotation(true, 180.0f, 90.0f);
--this.ticks;
} else {
this.reset();
}
} else if (!this.isRotated) {
this.updateRotation(false, 80.0f, 35.0f);
}
if (followTarget.get() && mc.player.isElytraFlying()) {
if (elytraTargetType.is("ElytraTarget | Legit")) {
lookAtTarget(target);
} else if (elytraTargetType.is("ElytraTarget | Rage")) {
flyTowardsTarget2(target);
}
}
} else {
this.stopWatch.setLastMS(0L);
this.reset();
}
}
private void flyTowardsTarget(LivingEntity target) {
if (target == null || mc.player == null) {
return;
}
if (elytraTargetType.is("ElytraTarget | Legit")) {
lookAtTarget(target);
} else if (elytraTargetType.is("ElytraTarget | Rage")) {
flyTowardsTarget2(target);
} else {
lookAtTarget(target);
}
}
private void flyTowardsTarget2(LivingEntity target) {
if (target == null || mc.player == null) {
return;
}
Vector3d targetBodyPos = new Vector3d(target.getPosX(), target.getPosY() + target.getEyeHeight(), target.getPosZ());
Vector3d playerPos = mc.player.getPositionVec();
double diffX = targetBodyPos.x - playerPos.x;
double diffY = targetBodyPos.y - playerPos.y;
double diffZ = targetBodyPos.z - playerPos.z;
double distance = playerPos.distanceTo(targetBodyPos);
if (distance < 0.1) {
return;
}
float a = ggg.get();
double speedFactor = Math.min(a, distance / 2.0);
double motionX = (diffX / distance) * speedFactor;
double motionY = (diffY / distance) * speedFactor;
double motionZ = (diffZ / distance) * speedFactor;
double checkX = playerPos.x + motionX;
double checkY = playerPos.y + motionY;
double checkZ = playerPos.z + motionZ;
if (!isPathClear(playerPos, new Vector3d(checkX, checkY, checkZ))) {
Vector3d adjustedMotion = adjustForObstacles(playerPos, new Vector3d(motionX, motionY, motionZ));
motionX = adjustedMotion.x;
motionY = adjustedMotion.y;
motionZ = adjustedMotion.z;
}
mc.player.setMotion(new Vector3d(motionX, motionY, motionZ));
}
private boolean isPathClear(Vector3d start, Vector3d end) {
Minecraft mc = Minecraft.getInstance();
World world = mc.world;
for (double i = 0; i < 1.0; i += 0.1) {
double x = start.x + (end.x - start.x) * i;
double y = start.y + (end.y - start.y) * i;
double z = start.z + (end.z - start.z) * i;
BlockPos pos = new BlockPos(x, y, z);
if (!world.isAirBlock(pos)) {
return false;
}
}
return true;
}
private Vector3d adjustForObstacles(Vector3d startPos, Vector3d direction) {
Minecraft mc = Minecraft.getInstance();
World world = mc.world;
for (int i = 1; i <= 3; i++) {
Vector3d newPos = startPos.add(direction.x, direction.y + i, direction.z);
if (isPathClear(startPos, newPos)) {
return new Vector3d(direction.x, direction.y + i, direction.z);
}
}
for (int i = 1; i <= 3; i++) {
Vector3d newPos = startPos.add(direction.x + i, direction.y, direction.z);
if (isPathClear(startPos, newPos)) {
return new Vector3d(direction.x + i, direction.y, direction.z);
}
}
return direction;
}
private void lookAtTarget(LivingEntity target) {
Vector3d targetPos = new Vector3d(target.getPosX(), target.getPosY() + target.getEyeHeight(), target.getPosZ());
Vector3d playerPos = mc.player.getPositionVec().add(0, mc.player.getEyeHeight(), 0);
double diffX = targetPos.x - playerPos.x;
double diffY = targetPos.y - playerPos.y;
double diffZ = targetPos.z - playerPos.z;
double distance = Math.sqrt(diffX * diffX + diffY * diffY + diffZ * diffZ);
double dirX = diffX / distance;
double dirY = diffY / distance;
double dirZ = diffZ / distance;
float yaw = (float) (Math.atan2(diffZ, diffX) * (180 / Math.PI)) - 90;
float pitch = (float) -(Math.atan2(diffY, Math.sqrt(diffX * diffX + diffZ * diffZ)) * (180 / Math.PI));
mc.player.rotationYaw = yaw;
mc.player.rotationPitch = pitch;
Vector3d currentMotion = mc.player.getMotion();
double currentSpeed = currentMotion.length();
mc.player.setMotion(dirX * currentSpeed, dirY * currentSpeed, dirZ * currentSpeed);
}
@Subscribe
private void onWalking(EventMotion e) {
if (this.target == null || this.autoPotion.isState() && this.autoPotion.isActive()) {
return;
}
float yaw = this.rotateVector.x;
float pitch = this.rotateVector.y;
e.setYaw(yaw);
e.setPitch(pitch);
KillAura.mc.player.rotationYawHead = yaw;
KillAura.mc.player.renderYawOffset = yaw;
KillAura.mc.player.rotationPitchHead = pitch;
}
private void updateTarget() {
ArrayList<Object> targets = new ArrayList<Object>();
for (Entity entity : KillAura.mc.world.getAllEntities()) {
LivingEntity living;
if (!(entity instanceof LivingEntity) || !this.isValid(living = (LivingEntity)entity)) continue;
targets.add(living);
}
if (targets.isEmpty()) {
this.target = null;
return;
}
if (targets.size() == 1) {
this.target = (LivingEntity)targets.get(0);
return;
}
targets.sort(Comparator.comparingDouble(object -> {
if (object instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity)object;
return -this.getEntityArmor(player);
}
if (object instanceof LivingEntity) {
LivingEntity base = (LivingEntity)object;
return -base.getTotalArmorValue();
}
return 0.0;
}).thenComparing((object, object2) -> {
double d2 = this.getEntityHealth((LivingEntity)object);
double d3 = this.getEntityHealth((LivingEntity)object2);
return Double.compare(d2, d3);
}).thenComparing((object, object2) -> {
double d2 = KillAura.mc.player.getDistance((LivingEntity)object);
double d3 = KillAura.mc.player.getDistance((LivingEntity)object2);
return Double.compare(d2, d3);
}));
this.target = (LivingEntity)targets.get(0);
}
private void updateRotation(boolean attack, float rotationYawSpeed, float rotationPitchSpeed) {
Vector3d vec = this.target.getPositionVec().add(0.0, MathHelper.clamp(KillAura.mc.player.getPosYEye() - this.target.getPosY(), 0.0, (double)this.target.getHeight() * (KillAura.mc.player.getDistanceEyePos(this.target) / (double)((Float)this.attackRange.get()).floatValue())), 0.0).subtract(KillAura.mc.player.getEyePosition(1.0f));
this.isRotated = true;
float yawToTarget = (float)MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(vec.z, vec.x)) - 90.0);
float pitchToTarget = (float)(-Math.toDegrees(Math.atan2(vec.y, Math.hypot(vec.x, vec.z))));
float yawDelta = MathHelper.wrapDegrees(yawToTarget - this.rotateVector.x);
float pitchDelta = MathHelper.wrapDegrees(pitchToTarget - this.rotateVector.y);
int roundedYaw = (int)yawDelta;
switch ((String)this.type.get()) {
case "Плавная": {
float clampedYaw = Math.min(Math.max(Math.abs(yawDelta), 1.0f), rotationYawSpeed);
float clampedPitch = Math.min(Math.max(Math.abs(pitchDelta), 1.0f), rotationPitchSpeed);
clampedPitch = attack && this.selected != this.target && ((Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()).booleanValue() ? Math.max(Math.abs(pitchDelta), 1.0f) : (clampedPitch /= 3.0f);
if (Math.abs(clampedYaw - this.lastYaw) <= 3.0f) {
clampedYaw = this.lastYaw + 3.1f;
}
float yaw = this.rotateVector.x + (yawDelta > 0.0f ? clampedYaw : -clampedYaw);
float pitch = MathHelper.clamp(this.rotateVector.y + (pitchDelta > 0.0f ? clampedPitch : -clampedPitch), -89.0f, 89.0f);
float gcd = SensUtils.getGCDValue();
yaw -= (yaw - this.rotateVector.x) % gcd;
pitch -= (pitch - this.rotateVector.y) % gcd;
this.rotateVector = new Vector2f(yaw, pitch);
this.lastYaw = clampedYaw;
this.lastPitch = clampedPitch;
if (!((Boolean)this.options.getValueByName("Коррекция движения").get()).booleanValue()) break;
KillAura.mc.player.rotationYawOffset = yaw;
break;
}
case "Резкая": {
float yaw = this.rotateVector.x + (float)roundedYaw;
float pitch = MathHelper.clamp(this.rotateVector.y + pitchDelta, -90.0f, 90.0f);
float gcd = SensUtils.getGCDValue();
yaw -= (yaw - this.rotateVector.x) % gcd;
pitch -= (pitch - this.rotateVector.y) % gcd;
this.rotateVector = new Vector2f(yaw, pitch);
if (!((Boolean)this.options.getValueByName("Коррекция движения").get()).booleanValue()) break;
KillAura.mc.player.rotationYawOffset = yaw;
}
}
}
private void updateAttack() {
this.selected = MouseUtil.getMouseOver(this.target, this.rotateVector.x, this.rotateVector.y, ((Float)this.attackRange.get()).floatValue());
if (((Boolean)this.options.getValueByName("Ускорять ротацию при атаке").get()).booleanValue()) {
this.updateRotation(true, 60.0f, 35.0f);
}
if (followTarget.get() && mc.player.isElytraFlying()) {
this.selected = MouseUtil.getMouseOver(this.target, this.rotateVector.x, this.rotateVector.y, ((Float)this.attackRange.get()).floatValue());
}
if (!(this.selected != null && this.selected == this.target)) {
return;
}
if (KillAura.mc.player.isBlocking() && ((Boolean)this.options.getValueByName("Отжимать щит").get()).booleanValue()) {
KillAura.mc.playerController.onStoppedUsingItem(KillAura.mc.player);
}
this.stopWatch.setLastMS(500L);
KillAura.mc.playerController.attackEntity(KillAura.mc.player, this.target);
KillAura.mc.player.swingArm(Hand.MAIN_HAND);
LivingEntity livingEntity = (LivingEntity)this.target;
}
private boolean shouldPlayerFalling() {
boolean cancelReason = KillAura.mc.player.isInWater() && KillAura.mc.player.areEyesInFluid(FluidTags.WATER) || KillAura.mc.player.isInLava() || KillAura.mc.player.isOnLadder() || KillAura.mc.player.isPassenger() || KillAura.mc.player.abilities.isFlying;
float attackStrength = KillAura.mc.player.getCooledAttackStrength((Boolean)this.options.getValueByName("Синхронизировать атаку с ТПС").get() != false ? Infinity.getInstance().getTpsCalc().getAdjustTicks() : 1.5f);
if (attackStrength < 0.92f) {
return false;
}
if (!cancelReason && ((Boolean)this.options.getValueByName("Только криты").get()).booleanValue()) {
return !KillAura.mc.player.isOnGround() && KillAura.mc.player.fallDistance > 0.0f;
}
return true;
}
private boolean isValid(LivingEntity entity) {
if (entity instanceof ClientPlayerEntity) {
return false;
}
if (entity.ticksExisted < 3) {
return false;
}
if (followTarget.get() && mc.player.isElytraFlying()) {
if (KillAura.mc.player.getDistanceEyePos(entity) > (double)((Float)this.newSliderSetting.get()).floatValue()) {
return false;
}
} else {
if (KillAura.mc.player.getDistanceEyePos(entity) > (double)((Float)this.attackRange.get()).floatValue()) {
return false;
}
}
if (entity instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) entity;
if (AntiBot.isBot(entity)) {
return false;
}
if (!((Boolean) this.targets.getValueByName("Друзья").get()).booleanValue() && FriendStorage.isFriend(player.getName().getString())) {
return false;
}
if (player.getName().getString().equalsIgnoreCase(KillAura.mc.player.getName().getString())) {
return false;
}
}
if (entity instanceof PlayerEntity) {
if (!((Boolean) this.targets.getValueByName("Игроки").get()).booleanValue()) {
return false;
}
if (entity.getTotalArmorValue() == 0 && !((Boolean) this.targets.getValueByName("Голые").get()).booleanValue()) {
return false;
}
if (entity.isInvisible() && entity.getTotalArmorValue() == 0 && !((Boolean) this.targets.getValueByName("Голые невидимки").get()).booleanValue()) {
return false;
}
if (entity.isInvisible() && !((Boolean) this.targets.getValueByName("Невидимки").get()).booleanValue()) {
return false;
}
} else if (entity instanceof MonsterEntity) {
if (!((Boolean) this.targets.getValueByName("Мобы").get()).booleanValue()) {
return false;
}
} else if (entity instanceof AnimalEntity) {
if (!((Boolean) this.targets.getValueByName("Животные").get()).booleanValue()) {
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();
KillAura.mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, KillAura.mc.player);
KillAura.mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, KillAura.mc.player);
KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(bestSlot));
KillAura.mc.playerController.attackEntity(KillAura.mc.player, entity);
KillAura.mc.player.swingArm(Hand.MAIN_HAND);
KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(KillAura.mc.player.inventory.currentItem));
KillAura.mc.playerController.windowClick(0, bestSlot + 36, 0, ClickType.PICKUP, KillAura.mc.player);
KillAura.mc.playerController.windowClick(0, invSlot, 0, ClickType.PICKUP, KillAura.mc.player);
}
if (hotBarSlot != -1) {
KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(hotBarSlot));
KillAura.mc.playerController.attackEntity(KillAura.mc.player, entity);
KillAura.mc.player.swingArm(Hand.MAIN_HAND);
KillAura.mc.player.connection.sendPacket(new CHeldItemChangePacket(KillAura.mc.player.inventory.currentItem));
}
}
}
private void reset() {
if (((Boolean)this.options.getValueByName("Коррекция движения").get()).booleanValue()) {
KillAura.mc.player.rotationYawOffset = -2.1474836E9f;
}
this.rotateVector = new Vector2f(KillAura.mc.player.rotationYaw, KillAura.mc.player.rotationPitch);
}
@Override
public void onEnable() {
super.onEnable();
this.reset();
this.target = null;
}
@Override
public void onDisable() {
super.onDisable();
this.reset();
this.stopWatch.setLastMS(0L);
this.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 += this.getProtectionLvl(is);
}
return d2;
}
private double getProtectionLvl(ItemStack stack) {
Item item = stack.getItem();
if (item instanceof ArmorItem) {
ArmorItem i = (ArmorItem)item;
double damageReduceAmount = i.getDamageReduceAmount();
if (stack.isEnchanted()) {
damageReduceAmount += (double)EnchantmentHelper.getEnchantmentLevel(Enchantments.PROTECTION, stack) * 0.25;
}
return damageReduceAmount;
}
return 0.0;
}
private double getEntityHealth(LivingEntity ent) {
if (ent instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity)ent;
return (double)(player.getHealth() + player.getAbsorptionAmount()) * (this.getEntityArmor(player) / 20.0);
}
return ent.getHealth() + ent.getAbsorptionAmount();
}
public ModeSetting getType() {
return this.type;
}
public ModeListSetting getOptions() {
return this.options;
}
public StopWatch getStopWatch() {
return this.stopWatch;
}
public LivingEntity getTarget() {
return this.target;
}
}