Начинающий
Начинающий
- Статус
- Оффлайн
- Регистрация
- 2 Сен 2024
- Сообщения
- 6
- Реакции
- 0
Дайте пожайлуста любой работающий обход на fabric 1.21.4 или на другую версию но fabric, у меня уже какой не какой обход есть:
Этот обход коррекно работает ток на mc.reallyworld.ru (noad), я бы хотел чтобы он работал на каких нибудь пвп серверах
(Да я знаю говно код, не бейте меня за это)package me.raid.raiddev.hp.module.list.raiddevhphphp;
import me.raid.raiddev.hp.module.list.RaidDevHPHPHP;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.AxeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SwordItem;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import java.util.Objects;
import java.util.Random;
import static me.raid.raiddev.hp.util.MinecraftUtil.mc;
/**
* Server-side rotation manager for aimbot functionality.
* Handles automatic targeting, smooth rotation, and camera restoration.
*
* Features:
* - Automatic target acquisition within 6 blocks
* - Natural-looking rotation with orbital movement
* - GCD normalization to bypass anti-cheat
* - Smooth camera restoration when target is lost
*/
public class RaidDev_HPHPHP {
// Current and target rotation states
private static RaidDev_HP currentRotation = null;
private static RaidDev_HP targetRotation = null;
private static boolean active = false;
// Random for natural movement variation
private static final Random random = new Random();
// Camera restoration state
private static boolean isRestoring = false;
private static RaidDev_HP restoreStartRotation = null;
private static long restoreStartTime = 0;
private static final long CAMERA_RESTORE_DURATION = 300; // milliseconds
// Target tracking
private static Entity currentTarget = null;
private static long targetAcquiredTime = 0;
// Orbital movement for natural-looking aim
private static float orbitPhase = 0;
private static final float ORBIT_SPEED = 0.008f;
// Timing
private static long lastUpdateTime = System.currentTimeMillis();
// Threshold for considering restoration complete
private static final float RESTORE_THRESHOLD = 1.0f;
/**
* Called every client tick to update rotation state.
*/
public static void tick() {
MinecraftClient client = MinecraftClient.getInstance();
if (!isValid()) {
reset();
return;
}
// Safety check - reset if player or world is null
if (client.player == null || client.world == null) {
reset();
return;
}
boolean hasWeapon = true;
// If no weapon, handle deactivation/restoration
if (!hasWeapon) {
if (active && !isRestoring) {
startRestoration();
} else if (isRestoring) {
handleRestoration(client);
} else {
syncWithPlayer(client);
}
return;
}
// Calculate delta time for smooth movement
long currentTime = System.currentTimeMillis();
float deltaTime = (currentTime - lastUpdateTime) / 1000.0f;
lastUpdateTime = currentTime;
// Initialize current rotation if needed
if (currentRotation == null) {
currentRotation = new RaidDev_HP(
MathHelper.wrapDegrees(client.player.getYaw()),
MathHelper.clamp(client.player.getPitch(), -90.0f, 90.0f)
);
}
// Find closest valid target
Entity target = findClosestTarget(client);
if (target != null) {
// Update target tracking
if (currentTarget != target) {
currentTarget = target;
targetAcquiredTime = currentTime;
orbitPhase = random.nextFloat() * 6.28f; // Random starting phase
}
// Cancel restoration if we found a target
if (isRestoring) {
isRestoring = false;
restoreStartRotation = null;
}
// Handle natural targeting with smooth rotation
handleNaturalTargeting(client, target, deltaTime);
} else {
// No target found
currentTarget = null;
if (active && !isRestoring) {
startRestoration();
} else if (isRestoring) {
handleRestoration(client);
} else {
syncWithPlayer(client);
}
}
}
/**
* Finds the closest player target within range.
*/
private static Entity findClosestTarget(MinecraftClient client) {
assert client.crosshairTarget != null;
assert client.player != null;
// Сначала проверяем стандартный crosshairTarget (он учитывает текущий, возможно увеличенный хитбокс)
if (client.crosshairTarget.getType() == HitResult.Type.ENTITY) {
EntityHitResult entityHit = (EntityHitResult) client.crosshairTarget;
Entity targeted = entityHit.getEntity();
if (!(targeted instanceof PlayerEntity) || targeted == client.player) {
return null;
}
PlayerEntity playerTarget = (PlayerEntity) targeted;
// Проверяем дистанцию ≤ 6 блоков
double distanceSq = client.player.squaredDistanceTo(playerTarget);
if (distanceSq >= 36.0) { // 6^2 = 36
return null;
}
// Теперь ключевой момент: проверяем, попал ли бы луч в ОРИГИНАЛЬНЫЙ хитбокс
if (isRayHittingOriginalHitbox(client, playerTarget)) {
// Попал в оригинальный — считаем это "честным" прицелом → НЕ активируем aim
return null;
}
// Если попал только в расширенный — активируем ротацию
return playerTarget;
}
return null;
}
/**
* Проверяет, пересекает ли текущий луч взгляда игрока оригинальный (нерасширенный) хитбокс цели.
*/
private static boolean isRayHittingOriginalHitbox(MinecraftClient client, PlayerEntity target) {
// Оригинальные размеры игрока (стандартные для PlayerEntity)
float width = target.getWidth(); // обычно 0.6f
float height = target.getHeight(); // обычно 1.8f
// Позиция нижней части сущности
double x = target.getX();
double y = target.getY();
double z = target.getZ();
// Оригинальный bounding box (как в vanilla)
Box originalBox = new Box(
x - width / 2, y, z - width / 2,
x + width / 2, y + height, z + width / 2
);
// Луч взгляда от глаз игрока в направлении взгляда на дальность, например, 6 блоков
Vec3d eyePos = client.player.getEyePos();
Vec3d viewVec = client.player.getRotationVec(1.0f);
Vec3d endPos = eyePos.add(viewVec.multiply(6.0)); // дальность проверки
// Проверяем пересечение луча с оригинальным хитбоксом
return originalBox.raycast(eyePos, endPos).isPresent();
}
/**
* Handles natural-looking targeting with orbital movement and aim point cycling.
*/
/**
* Handles natural-looking targeting with orbital movement and aim point cycling.
* Now only aims at visible parts of the target (raycast to blocks check).
*/
private static void handleNaturalTargeting(MinecraftClient client, Entity target, float deltaTime) {
long timeSinceAcquired = System.currentTimeMillis() - targetAcquiredTime;
assert client.player != null;
Vec3d eyePos = client.player.getEyePos();
// Список возможных точек прицеливания (от головы до ног)
Vec3d[] possiblePoints = new Vec3d[]{
target.getPos().add(0, target.getHeight() * 0.75, 0),
target.getPos().add(0, target.getHeight() * 0.65, 0), // Грудь
target.getPos().add(0, target.getHeight() * 0.55, 0),
target.getPos().add(0, target.getHeight() * 0.45, 0),
target.getPos().add(0, target.getHeight() * 0.35, 0), // Живот/ноги
target.getPos().add(0, target.getHeight() * 0.25, 0),
target.getPos().add(0, target.getHeight() * 0.15, 0),
target.getPos().add(0, target.getHeight() * 0.05, 0) // Ноги
};
// Ищем первую видимую точку (сверху вниз — приоритет голове)
Vec3d aimPoint = null;
for (Vec3d point : possiblePoints) {
if (isPointVisible(eyePos, point)) {
aimPoint = point;
break;
}
}
// Если ни одна точка не видна — пытаемся найти хотя бы одну снизу вверх (для случаев, когда видны только ноги)
if (aimPoint == null) {
for (int i = possiblePoints.length - 1; i >= 0; i--) {
Vec3d point = possiblePoints;
if (isPointVisible(eyePos, point)) {
aimPoint = point;
break;
}
}
}
// Если вообще ничего не видно — выходим (аим отключится, начнётся восстановление камеры)
if (aimPoint == null) {
currentTarget = null; // Принудительно сбрасываем цель
return;
}
// === Добавляем лёгкую орбиталку только вокруг видимой точки ===
if (timeSinceAcquired > 1000) { // Через секунду после захвата
orbitPhase += ORBIT_SPEED * deltaTime * 20.0f;
if (orbitPhase > 6.28f) orbitPhase -= 6.28f;
Vec3d toTarget = aimPoint.subtract(eyePos).normalize();
Vec3d right = toTarget.crossProduct(new Vec3d(0, 1, 0)).normalize();
Vec3d up = right.crossProduct(toTarget).normalize();
float offsetHoriz = (float) Math.cos(orbitPhase) * 0.06f;
float offsetVert = (float) Math.sin(orbitPhase) * 0.04f;
Vec3d offset = right.multiply(offsetHoriz).add(up.multiply(offsetVert));
aimPoint = aimPoint.add(offset);
}
// Редкий "look away" — но только если цель всё ещё частично видна
long lookAwayCycle = timeSinceAcquired % 6000;
if (lookAwayCycle >= 5500 && lookAwayCycle <= 5700) {
Vec3d away = aimPoint.subtract(eyePos).normalize().multiply(-0.2);
aimPoint = aimPoint.add(away);
}
// Рассчитываем ротацию
targetRotation = calculateRotationToTarget(client.player, aimPoint);
// Скорость ротации (быстрее при "look away")
float baseSpeed = (lookAwayCycle >= 5500 && lookAwayCycle <= 5700) ? 28.0f : 14.0f;
// Плавная ротация
currentRotation = smoothRotateNatural(currentRotation, targetRotation, deltaTime, baseSpeed);
// Нормализация
currentRotation = new RaidDev_HP(
MathHelper.wrapDegrees(currentRotation.getYaw()),
MathHelper.clamp(currentRotation.getPitch(), -90.0f, 90.0f)
);
active = true;
}
/**
* Starts the camera restoration process when target is lost.
*/
private static void startRestoration() {
if (!isRestoring) {
isRestoring = true;
restoreStartRotation = currentRotation;
restoreStartTime = System.currentTimeMillis();
active = true;
}
}
/**
* Handles smooth camera restoration to player's actual view.
*/
private static void handleRestoration(MinecraftClient client) {
long currentTime = System.currentTimeMillis();
long elapsed = currentTime - restoreStartTime;
// Get player's current actual rotation
RaidDev_HP playerRotation = new RaidDev_HP(
MathHelper.wrapDegrees(Objects.requireNonNull(client.player).getYaw()),
MathHelper.clamp(client.player.getPitch(), -90.0f, 90.0f)
);
// Check if restoration is complete
if (elapsed >= CAMERA_RESTORE_DURATION) {
finishRestoration(playerRotation);
return;
}
// Calculate interpolation progress with easing
float progress = elapsed / 300.0f;
float easedProgress = easeOutCubic(progress);
// Interpolate from start rotation to player rotation
currentRotation = interpolateRotations(restoreStartRotation, playerRotation, easedProgress);
// Check if close enough to finish early
if (currentRotation.approximatelyEquals(playerRotation, RESTORE_THRESHOLD)) {
finishRestoration(playerRotation);
}
// Normalize the current rotation
currentRotation = new RaidDev_HP(
MathHelper.wrapDegrees(currentRotation.getYaw()),
MathHelper.clamp(currentRotation.getPitch(), -90.0f, 90.0f)
);
}
/**
* Completes the restoration process and resets state.
*/
private static void finishRestoration(RaidDev_HP finalRotation) {
currentRotation = finalRotation;
isRestoring = false;
restoreStartRotation = null;
active = false;
targetRotation = null;
currentTarget = null;
}
/**
* Syncs server rotation with player's actual rotation when inactive.
*/
private static void syncWithPlayer(MinecraftClient client) {
currentRotation = new RaidDev_HP(
MathHelper.wrapDegrees(Objects.requireNonNull(client.player).getYaw()),
MathHelper.clamp(client.player.getPitch(), -90.0f, 90.0f)
);
active = false;
targetRotation = null;
currentTarget = null;
}
/**
* Cubic ease-out function for smooth deceleration.
*/
private static float easeOutCubic(float t) {
return 1.0f - (float) Math.pow(1.0 - t, 3.0);
}
/**
* Interpolates between two rotations.
*/
private static RaidDev_HP interpolateRotations(RaidDev_HP from, RaidDev_HP to, float progress) {
float deltaYaw = MathHelper.wrapDegrees(to.getYaw() - from.getYaw());
float deltaPitch = to.getPitch() - from.getPitch();
float newYaw = from.getYaw() + deltaYaw * progress;
float newPitch = from.getPitch() + deltaPitch * progress;
return new RaidDev_HP(
MathHelper.wrapDegrees(newYaw),
MathHelper.clamp(newPitch, -90.0f, 90.0f)
);
}
/**
* Smoothly rotates towards target with natural-looking acceleration.
*/
private static RaidDev_HP smoothRotateNatural(RaidDev_HP current, RaidDev_HP target, float deltaTime, float baseSpeed) {
RaidDev_HPHP delta = current.rotationDeltaTo(target);
float distance = delta.length();
// Speed increases as we get closer (more natural snap)
float speedMultiplier = MathHelper.clamp(distance / 30.0f, 0.0f, 1.0f);
float speed = baseSpeed + speedMultiplier * baseSpeed * 0.5f;
// Calculate step size based on delta time
float stepSize = speed * deltaTime * 60.0f;
// Move towards target
RaidDev_HP newRotation = current.towardsLinear(target, stepSize, stepSize * 0.95f);
// Apply GCD normalization
return newRotation.normalize(current);
}
/**
* Calculates the rotation needed to look at a target point.
*/
private static RaidDev_HP calculateRotationToTarget(PlayerEntity player, Vec3d targetPos) {
Vec3d eyePos = player.getEyePos();
RaidDev_HP rotation = RaidDev_HP.fromRotationVec(targetPos.subtract(eyePos));
return new RaidDev_HP(
MathHelper.wrapDegrees(rotation.getYaw()),
MathHelper.clamp(rotation.getPitch(), -90.0f, 90.0f)
);
}
/**
* Resets all rotation state.
*/
public static void reset() {
active = false;
isRestoring = false;
targetRotation = null;
restoreStartRotation = null;
currentTarget = null;
orbitPhase = 0;
lastUpdateTime = System.currentTimeMillis();
}
/**
* Gets the server-side yaw angle.
*/
public static float getServerYaw() {
if (currentRotation == null) return 0;
return MathHelper.wrapDegrees(currentRotation.getYaw());
}
private static boolean isValid() {
MinecraftClient client = MinecraftClient.getInstance();
if (client.player == null || client.world == null) {
return false;
}
boolean result = RaidDevHPHPHP.instance != null &&
RaidDevHPHPHP.instance.isEnabled() &&
"Rotation".equals(RaidDevHPHPHP.instance.mode.getValue());
System.out.println("isValid: " + result + " (instance=" + (RaidDevHPHPHP.instance != null) + ", enabled=" + (RaidDevHPHPHP.instance != null ? RaidDevHPHPHP.instance.isEnabled() : false) + ", mode=" + (RaidDevHPHPHP.instance != null ? RaidDevHPHPHP.instance.mode.getValue() : "null"));
return result;
}
/**
* Gets the server-side pitch angle.
*/
public static float getServerPitch() {
if (currentRotation == null) return 0;
return MathHelper.clamp(currentRotation.getPitch(), -90.0f, 90.0f);
}
/**
* Проверяет, видна ли точка на цели (нет ли блоков на пути луча от глаз до точки)
*/
private static boolean isPointVisible(Vec3d eyePos, Vec3d targetPoint) {
MinecraftClient client = MinecraftClient.getInstance();
// Луч от глаз до точки
Vec3d direction = targetPoint.subtract(eyePos);
double distance = direction.length();
// Если слишком далеко — сразу нет (хотя у нас уже проверка на 6 блоков)
if (distance > 6.5) return false;
Vec3d endPos = eyePos.add(direction.normalize().multiply(distance - 0.1)); // чуть не доходя до точки
// Raycast по блокам
net.minecraft.util.hit.BlockHitResult blockHit = client.world.raycast(new net.minecraft.world.RaycastContext(
eyePos,
endPos,
net.minecraft.world.RaycastContext.ShapeType.COLLIDER,
net.minecraft.world.RaycastContext.FluidHandling.NONE,
client.player
));
// Если луч попал в блок — точка не видна
return blockHit.getType() == net.minecraft.util.hit.HitResult.Type.MISS;
}
/**
* Gets the current rotation object.
*/
public static RaidDev_HP getCurrentRotation() {
return currentRotation;
}
/**
* Checks if the aimbot is currently active.
*/
public static boolean isActive() {
return active;
}
/**
* Checks if camera restoration is in progress.
*/
public static boolean isRestoring() {
return isRestoring;
}
}
package me.raid.raiddev.hp.module.list;
import me.raid.raiddev.hp.module.Module;
import me.raid.raiddev.hp.module.ModuleCategory;
import me.raid.raiddev.hp.module.ModuleInformation;
import me.raid.raiddev.hp.module.list.raiddevhphphp.RaidDev_HPHPHP;
import me.raid.raiddev.hp.module.settings.ModeSetting;
import me.raid.raiddev.hp.module.settings.NumberSetting;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.Box;
import java.util.Set;
@ModuleInformation(
moduleName = "HitBox",
moduleDesc = "Increases hitbox, friends have no hitbox",
moduleCategory = ModuleCategory.COMBAT
)
public class RaidDevHPHPHP extends Module {
public final ModeSetting mode = new ModeSetting("Mode", this, "Vanila", "Vanila", "Rotation");
private final NumberSetting scale = new NumberSetting("Scale", this, 0.0, 0.0, 6.0, 0.1);
private final MinecraftClient mc = MinecraftClient.getInstance();
public static RaidDevHPHPHP instance;
public RaidDevHPHPHP() {
addSetting(scale);
addSetting(mode);
}
@Override
public void onEnable() {
super.onEnable();
instance = this;
ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick);
}
@Override
public void onDisable() {
super.onDisable();
RaidDev_HPHPHP.reset();
raud();
}
private void onClientTick(MinecraftClient client) {
if (!isEnabled() || client.player == null || client.world == null) return;
if (mode.getValue().equals("Vanila")) {
raid();
} else if (mode.getValue().equals("Rotation")) {
double slider = scale.getValue();
double wScale = 1.0 + slider;
double hScale = 1.0 + slider * 0.1;
Set<String> friends = RaidDev____HPHPHP.FRIENDS; // ← прямой доступ
for (Entity entity : mc.world.getEntities()) {
if (entity == mc.player || entity instanceof ItemEntity || !(entity instanceof LivingEntity)) {
continue;
}
double w0 = entity.getWidth();
double h0 = entity.getHeight();
double w1 = w0 * wScale;
double h1 = h0 * hScale;
double cx = entity.getX();
double cy = entity.getY() + h0 / 2;
double cz = entity.getZ();
double minX = cx - w1 / 2;
double maxX = cx + w1 / 2;
double minY = cy - h1 / 2;
double maxY = cy + h1 / 2;
double minZ = cz - w1 / 2;
double maxZ = cz + w1 / 2;
entity.setBoundingBox(new Box(minX, minY, minZ, maxX, maxY, maxZ));
}
}
}
private void raid() {
double slider = scale.getValue();
double wScale = 1.0 + slider;
double hScale = 1.0 + slider * 0.1;
for (Entity entity : mc.world.getEntities()) {
if (entity == mc.player || entity instanceof ItemEntity || !(entity instanceof LivingEntity)) {
continue;
}
// У остальных — увеличенный хитбокс
double w0 = entity.getWidth();
double h0 = entity.getHeight();
double w1 = w0 * wScale;
double h1 = h0 * hScale;
double cx = entity.getX();
double cy = entity.getY() + h0 / 2;
double cz = entity.getZ();
double minX = cx - w1 / 2;
double maxX = cx + w1 / 2;
double minY = cy - h1 / 2;
double maxY = cy + h1 / 2;
double minZ = cz - w1 / 2;
double maxZ = cz + w1 / 2;
entity.setBoundingBox(new Box(minX, minY, minZ, maxX, maxY, maxZ));
}
}
private void raud() {
if (mc.world == null) return;
for (Entity entity : mc.world.getEntities()) {
if (entity == mc.player || entity instanceof ItemEntity || !(entity instanceof LivingEntity)) {
continue;
}
double w0 = entity.getWidth();
double h0 = entity.getHeight();
double x = entity.getX();
double y = entity.getY();
double z = entity.getZ();
double minX = x - w0 / 2;
double maxX = x + w0 / 2;
double minY = y;
double maxY = y + h0;
double minZ = z - w0 / 2;
double maxZ = z + w0 / 2;
entity.setBoundingBox(new Box(minX, minY, minZ, maxX, maxY, maxZ));
}
}
public static boolean isEnabledStatic() {
return instance != null && instance.isEnabled();
}
public static String getCurrentMode() {
return instance != null ? instance.mode.getValue() : "Vanila";
}
}
Этот обход коррекно работает ток на mc.reallyworld.ru (noad), я бы хотел чтобы он работал на каких нибудь пвп серверах
Последнее редактирование: