umarfarooq112233

make pvp aimer mod clintside that aim on only players

Kodari AI
KodariOct 13 at 2:47 pm 2
PlayerAimAssist
Client-side Fabric mod that provides an aim assist feature targeting only players. When enabled, the mod automatically adjusts the player's crosshair toward the nearest valid player entity within a configurable range and angle. It includes a toggle keybind, visual indicator, and configuration options for sensitivity, range, and target selection. The mod uses raycasting to detect player entities and smooths the camera rotation toward the target, ignoring non-player entities like mobs and animals. Works in both single-player and multiplayer, with configurable activation modes such as always-on or while holding a key.
  1. Create a client-only Fabric mod project for Minecraft 26.2.

  2. Add tick-based aiming that selects other player entities only, with a limited target range and smooth rotation.

Created a client-only Fabric 26.2 PvP aimer. It smoothly turns toward the nearest eligible player within 12 blocks and a 55° aim cone; it ignores you, spectators, and non-player entities. The project files and client entrypoint are in place.

umarfarooq112233

how to enable this

Kodari AI
KodariOct 13 at 2:58 pm 1

The aimer has no in-game toggle right now—it activates automatically once the mod is loaded and you’re in a world.

To get the mod jar: click Compile in the top bar (or ⋮ → Compile Project on phone), click Compile in the window, then Download when it succeeds. Launch Minecraft 26.2 with Fabric and the mod installed.

umarfarooq112233

add hotkey that i can also change

Kodari AI
KodariOct 14 at 1:39 am 1
  1. Register a configurable client keybind, defaulting to R.

  2. Make the aimer toggle on/off and add its Controls-menu label.

Added Toggle PvP Aimer, bound to R by default. It starts disabled; press R to toggle it on or off. To change the key, open Options → Controls → Key Binds and rebind Toggle PvP Aimer.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 168
src/client/java/com/example/pvpaimer/PvpAimerClient.java
package com.example.pvpaimer;

import com.mojang.blaze3d.platform.InputConstants;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.world.phys.Vec3;
import org.lwjgl.glfw.GLFW;

public class PvpAimerClient implements ClientModInitializer {
	private static final double MAX_RANGE_SQUARED = 12.0 * 12.0;
	private static final double MAX_AIM_ANGLE_SQUARED = 55.0 * 55.0;
	private static final float SMOOTHING = 0.35F;
	private static KeyMapping toggleAimerKey;
	private static boolean enabled;

	@Override
	public void onInitializeClient() {
		toggleAimerKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
			"key.pvpaimer.toggle",
			InputConstants.Type.KEYSYM,
			GLFW.GLFW_KEY_R,
			KeyMapping.Category.MISC
		));
		ClientTickEvents.END_CLIENT_TICK.register(client -> {
			while (toggleAimerKey.consumeClick()) {
				enabled = !enabled;
			}
			if (enabled) {
				aimAtPlayer(client);
			}
		});
	}

	private static void aimAtPlayer(Minecraft client) {
		LocalPlayer localPlayer = client.player;
		ClientLevel level = client.level;
		if (localPlayer == null || level == null) {
			return;
		}

		float bestYaw = 0.0F;
		float bestPitch = 0.0F;
		double bestAngleSquared = Double.MAX_VALUE;
		boolean foundTarget = false;
		Vec3 eyePosition = localPlayer.getEyePosition();

		for (AbstractClientPlayer target : level.players()) {
			if (target == localPlayer || !target.isAlive() || target.isSpectator()) {
				continue;
			}

			Vec3 direction = eyePosition.vectorTo(target.getEyePosition());
			if (direction.lengthSqr() > MAX_RANGE_SQUARED) {
				continue;
			}

			double horizontalDistance = Math.sqrt(direction.x() * direction.x() + direction.z() * direction.z());
			float targetYaw = (float) (Math.atan2(direction.z(), direction.x()) * 180.0 / Math.PI - 90.0);
			float targetPitch = (float) (-Math.atan2(direction.y(), horizontalDistance) * 180.0 / Math.PI);
			float yawDifference = wrapDegrees(targetYaw - localPlayer.getYRot());
			float pitchDifference = targetPitch - localPlayer.getXRot();
			double angleSquared = yawDifference * yawDifference + pitchDifference * pitchDifference;

			if (angleSquared > MAX_AIM_ANGLE_SQUARED || angleSquared >= bestAngleSquared) {
				continue;
			}

			bestAngleSquared = angleSquared;
			bestYaw = targetYaw;
			bestPitch = targetPitch;
			foundTarget = true;
		}

		if (foundTarget) {
			float yaw = localPlayer.getYRot() + wrapDegrees(bestYaw - localPlayer.getYRot()) * SMOOTHING;
			float pitch = localPlayer.getXRot() + (bestPitch - localPlayer.getXRot()) * SMOOTHING;
			localPlayer.setYRot(yaw);
			localPlayer.setXRot(Math.max(-90.0F, Math.min(90.0F, pitch)));
		}
	}

	private static float wrapDegrees(float degrees) {
		degrees %= 360.0F;
		if (degrees >= 180.0F) {
			degrees -= 360.0F;
		}
		if (degrees < -180.0F) {
			degrees += 360.0F;
		}
		return degrees;
	}
}