Начинающий
- Статус
- Оффлайн
- Регистрация
- 11 Апр 2024
- Сообщения
- 141
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Java:
@ModuleInfo(
name = "AimBot",
category = Category.COMBAT,
desc = "Наведение прицела."
)
public class AimBot extends Module {
public BooleanSetting player = new BooleanSetting("Игроки", true);
public BooleanSetting golyPlayer = new BooleanSetting("Голые", true);
public BooleanSetting mobs = new BooleanSetting("Мобы", false);
public BooleanSetting friend = new BooleanSetting("Друзья", false);
public MultiBooleanSetting targets = new MultiBooleanSetting(this,"Цели",player,golyPlayer,mobs,friend);
public SliderSetting speed = new SliderSetting(this,"Скорость",0.08F,0.02F,1.2F,0.01F);
public static LivingEntity target;
@EventHandler
public void onEvent(EventUpdate eventUpdate) {
if ((target == null || !isValidTarget(target))) {
updateTarget();
}
if (target == null || mc.player == null || mc.world == null) {
target = null;
return;
}
}
private Vec2f rot = Vec2f.ZERO;
@EventHandler
public void onEvent(Render2DEvent event) {
if (target != null && mc.player != null && mc.world != null) {
Vec3d vec = target.getPos().add(0, MathHelper.clamp(mc.player.getEyePos().y - target.getY(), 0, 1), 0).subtract(mc.player.getEyePos()).normalize();
float targetYaw = (float) Math.toDegrees(Math.atan2(-vec.x, vec.z));
float currentYaw = mc.player.getYaw();
float yawDelta = MathHelper.wrapDegrees(targetYaw - currentYaw);
float speed = this.speed.getValue();
float smoothYaw = currentYaw + yawDelta * speed;
mc.player.setYaw(GCDUtil.applyGCD(smoothYaw , currentYaw));
}
}
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)) continue;
if (!isValidTarget(living)) continue;
Vec3d targetPos = living.getPos().add(0, living.getHeight() * 0.5, 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 boolean isValidTarget(LivingEntity entity) {
if (entity instanceof ClientPlayerEntity) return false;
if (mc.player.distanceTo(entity) > 4) return false;
if (!mc.player.canSee(entity)) return false;
if (entity instanceof PlayerEntity p) {
if (ClientInit.inst().friendManager().isFriend(p.getName().getString()) && !friend.getValue()) return false;
}
if (entity instanceof PlayerEntity && !player.getValue()) return false;
if (entity instanceof PlayerEntity && entity.getArmorVisibility() <= 0 && !golyPlayer.getValue()) return false;
if (entity instanceof PlayerEntity && ((PlayerEntity) entity).isCreative()) return false;
if ((entity instanceof Monster || entity instanceof SlimeEntity || entity instanceof VillagerEntity || entity instanceof AnimalEntity)
&& !mobs.getValue()) return false;
return !entity.isInvulnerable() && entity.isAlive() && !(entity instanceof ArmorStandEntity);
}
}
деф утилка
public static float applyGCD(float targetRotation, float currentRotation) {
float sensitivity = mc.options.getMouseSensitivity().getValue().floatValue();
float f = sensitivity * 0.6F + 0.2F;
float f1 = f * f * f * 8.0F;
float delta = targetRotation - currentRotation;
float adjustedDelta = Math.round(delta / (f1 * 0.15F)) * (f1 * 0.15F);
return currentRotation + adjustedDelta;
}
Последнее редактирование: