Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Пасибоpackage dev.arahis.functions.impl.misc;
import com.google.common.eventbus.Subscribe;
import dev.arahis.command.friends.FriendStorage;
import dev.arahis.events.EventPacket;
import dev.arahis.events.EventUpdate;
import dev.arahis.functions.api.Category;
import dev.arahis.functions.api.Function;
import dev.arahis.functions.api.FunctionRegister;
import dev.arahis.functions.settings.impl.BooleanSetting;
import dev.arahis.functions.settings.impl.SliderSetting;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.play.client.CUseEntityPacket;
import net.minecraft.util.math.MathHelper;
@FunctionRegister(name = "AimBot", type = Category.Combat)
public class AimBot extends Function {
private final SliderSetting distanceSetting = new SliderSetting("Дистанция", 5.0f, 2.0f, 10.0f, 0.1f);
private final SliderSetting yawSpeedSetting = new SliderSetting("Yaw Скорость", 110.0f, 0.0f, 200.0f, 1.0f);
private final SliderSetting pitchSpeedSetting = new SliderSetting("Pitch Скорость", 35.0f, 0.0f, 100.0f, 1.0f);
private final BooleanSetting targetFriendsSetting = new BooleanSetting("Таргетить друзей", false);
private final BooleanSetting targetInvisibleSetting = new BooleanSetting("Таргетить инвизок", false);
private PlayerEntity currentTarget;
private static final Minecraft mc = Minecraft.getInstance();
public AimBot() {
addSettings(distanceSetting, yawSpeedSetting, pitchSpeedSetting, targetFriendsSetting, targetInvisibleSetting);
}
@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) {
currentTarget = findClosestPlayer();
if (currentTarget != null && mc.player.getDistance(currentTarget) <= distanceSetting.get()) {
float[] targetRotations = calculateRotations(currentTarget);
mc.player.rotationYaw = smoothRotation(mc.player.rotationYaw, targetRotations[0], yawSpeedSetting.get() / 100.0f);
mc.player.rotationPitch = smoothRotation(mc.player.rotationPitch, targetRotations[1], pitchSpeedSetting.get() / 100.0f);
// mc.player.connection.sendPacket(new CUseEntityPacket(currentTarget, CUseEntityPacket.Action.ATTACK));
}
}
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()) {
closestPlayer = player;
closestDistanceSq = distanceSq;
}
}
}
return closestPlayer;
}
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);
return current + delta * factor;
}
}
Легитный аим бот код я чуть чуть переделал который тип кинул