говноУвидел,что данная функция набирает популярность, но на югейме не нашел, так что вот вам легит аура!
ss(noad):Меня кикнуло, за то что ротация была слишком быстрая, по идее с 10-18 кикать не будет
а вот и сам код
LegitAura:package im.tokyoware.functions.impl.combat; import com.google.common.eventbus.Subscribe; import im.tokyoware.command.friends.FriendStorage; import im.tokyoware.events.EventPacket; import im.tokyoware.events.EventUpdate; import im.tokyoware.functions.api.Category; import im.tokyoware.functions.api.Function; import im.tokyoware.functions.api.FunctionRegister; import im.tokyoware.functions.settings.impl.BooleanSetting; import im.tokyoware.functions.settings.impl.SliderSetting; import im.tokyoware.utils.math.StopWatch; import im.tokyoware.utils.player.AttackUtil; import im.tokyoware.utils.player.InventoryUtil; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.inventory.container.ClickType; import net.minecraft.network.play.client.CEntityActionPacket; import net.minecraft.network.play.client.CHeldItemChangePacket; import net.minecraft.network.play.client.CUseEntityPacket; import net.minecraft.util.Hand; import net.minecraft.util.math.EntityRayTraceResult; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.RayTraceContext; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.vector.Vector3d; @FunctionRegister(name = "LegitAura", type = Category.Combat) public class LegitAura extends Function { private final SliderSetting distanceSetting = new SliderSetting("Дистанция", 5.0f, 2.0f, 7.0f, 0.1f); private final SliderSetting yawSpeedSetting = new SliderSetting("Гориз. скорость", 10.0f, 0.0f, 50.0f, 0.5f); private final SliderSetting pitchSpeedSetting = new SliderSetting("Вертx. скорость ", 3.0f, 0.0f, 50.0f, 0.5f); private final BooleanSetting targetFriendsSetting = new BooleanSetting("Таргетить друзей", false); private final BooleanSetting targetInvisibleSetting = new BooleanSetting("Таргетить инвизок", false); private final BooleanSetting players = new BooleanSetting("Игроки", true); private final BooleanSetting mobs = new BooleanSetting("Мобы", true); private final BooleanSetting animals = new BooleanSetting("Животные", true); private final BooleanSetting onlyCrit = new BooleanSetting("Только криты", true); private final BooleanSetting shieldBreak = new BooleanSetting("Ломать щит", false); private PlayerEntity currentTarget; private static final Minecraft mc = Minecraft.getInstance(); private final StopWatch stopWatch = new StopWatch(); public LegitAura() { addSettings(distanceSetting, yawSpeedSetting, pitchSpeedSetting, targetFriendsSetting, targetInvisibleSetting, players, mobs, animals, onlyCrit, shieldBreak); } @Subscribe public void onPacket(EventPacket event) { if (event.getPacket() instanceof CUseEntityPacket) { CUseEntityPacket packet = (CUseEntityPacket) event.getPacket(); Entity targetEntity = packet.getEntityFromWorld(mc.world); if (targetEntity instanceof PlayerEntity) { currentTarget = (PlayerEntity) targetEntity; } } } @Subscribe public void onUpdate(EventUpdate event) { if (currentTarget != null) { if (mc.player.getDistance(currentTarget) <= distanceSetting.get() && !isWallBetween(mc.player, currentTarget)) { float[] targetRotations = calculateRotations(currentTarget); mc.player.rotationYaw = lerpAngle(mc.player.rotationYaw, targetRotations[0], yawSpeedSetting.get()); mc.player.rotationPitch = lerpAngle(mc.player.rotationPitch, targetRotations[1], pitchSpeedSetting.get()); } else { currentTarget = null; } } else { currentTarget = findClosestPlayer(); } // Handle TriggerBot functionality Entity entity = getValidEntity(); if (entity == null || mc.player == null) { return; } if (shouldAttack()) { stopWatch.setLastMS(500); attackEntity(entity); } } private boolean shouldAttack() { return AttackUtil.isPlayerFalling(onlyCrit.get(), true, false) && stopWatch.hasTimeElapsed(); } private void attackEntity(Entity entity) { boolean shouldStopSprinting = false; if (onlyCrit.get() && CEntityActionPacket.lastUpdatedSprint) { mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.STOP_SPRINTING)); shouldStopSprinting = true; } mc.playerController.attackEntity(mc.player, entity); mc.player.swingArm(Hand.MAIN_HAND); if (shieldBreak.get() && entity instanceof PlayerEntity) breakShieldPlayer(entity); if (shouldStopSprinting) { mc.player.connection.sendPacket(new CEntityActionPacket(mc.player, CEntityActionPacket.Action.START_SPRINTING)); } } private Entity getValidEntity() { if (mc.objectMouseOver.getType() == RayTraceResult.Type.ENTITY) { Entity entity = ((EntityRayTraceResult) mc.objectMouseOver).getEntity(); if (checkEntity((LivingEntity) entity)) { return entity; } } return null; } public static void breakShieldPlayer(Entity entity) { if (((LivingEntity) 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 boolean checkEntity(LivingEntity entity) { if (FriendStorage.isFriend(entity.getName().getString())) { return false; } AttackUtil entitySelector = new AttackUtil(); if (players.get()) { entitySelector.apply(AttackUtil.EntityType.PLAYERS); } if (mobs.get()) { entitySelector.apply(AttackUtil.EntityType.MOBS); } if (animals.get()) { entitySelector.apply(AttackUtil.EntityType.ANIMALS); } return entitySelector.ofType(entity, entitySelector.build()) != null && entity.isAlive(); } private PlayerEntity findClosestPlayer() { PlayerEntity closestPlayer = null; double closestDistanceSq = Double.MAX_VALUE; for (PlayerEntity player : mc.world.getPlayers()) { if (player != mc.player && (!FriendStorage.isFriend(player.getName().getString()) || targetFriendsSetting.get()) && (!player.isInvisible() || targetInvisibleSetting.get())) { double distanceSq = mc.player.getDistanceSq(player); if (distanceSq < closestDistanceSq && distanceSq <= distanceSetting.get() * distanceSetting.get() && !isWallBetween(mc.player, player)) { closestPlayer = player; closestDistanceSq = distanceSq; } } } return closestPlayer; } private boolean isWallBetween(Entity from, Entity to) { Vector3d fromVec = new Vector3d(from.getPosX(), from.getPosYEye(), from.getPosZ()); Vector3d toVec = new Vector3d(to.getPosX(), to.getPosYEye(), to.getPosZ()); RayTraceResult result = mc.world.rayTraceBlocks(new RayTraceContext(fromVec, toVec, RayTraceContext.BlockMode.COLLIDER, RayTraceContext.FluidMode.NONE, from)); return result.getType() == RayTraceResult.Type.BLOCK; } private float[] calculateRotations(Entity entity) { double x = entity.getPosX() - mc.player.getPosX(); double y = entity.getPosY() - mc.player.getPosY() + entity.getEyeHeight() - mc.player.getEyeHeight(); double z = entity.getPosZ() - mc.player.getPosZ(); double dist = Math.sqrt(x * x + z * z); float yaw = (float) ((Math.atan2(z, x) * 180 / Math.PI) - 90); float pitch = (float) (-(Math.atan2(y, dist) * 180 / Math.PI)); return new float[]{yaw, pitch}; } private float smoothRotation(float current, float target, float factor) { float delta = MathHelper.wrapDegrees(target - current); float smoothFactor = factor * 0.2f; if (Math.abs(delta) > 0.01f) { current += delta * smoothFactor * Math.min(1.0f, Math.abs(delta) / 45.0f); } return current; } private float lerpAngle(float current, float target, float factor) { float delta = MathHelper.wrapDegrees(target - current); return current + delta * (factor / 100.0f) * (Math.abs(delta) > 0.05f ? 0.2f : 0.05f); } @Override public void onDisable() { stopWatch.reset(); super.onDisable(); } }
почему? ротацию нормальную сделать и очень даже хороша, а так ты обиделся за то что я в твоей теме написал "фу"))говно
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz