Samarth

make a client side fabric mod for 1.21.11 fully optimised for mobile launchers like cs launcher plus named 'Clean Player Hitbox' which make Minecraft hitbox to be visible for other players not for items, entities and even our own hitbox also remove the blue line in the hitbox and red height and make the hitbox turn red when our crosshair is placed on the hitbox and set back to normal white hitbox when removed from hitbox only change colour if the player can hit the player not by just looking at the hitbox from distance ensure everything works perfectly

Kodari AI
KodariOct 26 at 4:58 pm 3
CleanPlayerHitbox
Client-side Fabric mod for Minecraft 1.21.11, optimized for mobile launchers like CS Launcher Plus. Renders visible hitboxes exclusively for other players, excluding items, entities, and the player's own hitbox. Removes the default blue outline and red height indicator. Hitbox turns red when the crosshair targets a player within attack range, reverting to white when the target is out of reach or the crosshair moves away. Lightweight and fully compatible with mobile performance constraints.
  1. Confirm the 1.21.11 rendering and hit-testing APIs needed for player-only hitboxes.

  2. Create the client mod, mixin/configuration, and required project metadata.

Created the Clean Player Hitbox client-side Fabric 1.21.11 mod.

  • Other players’ hitboxes are always drawn as clean white boxes; your own hitbox is excluded.

  • The box turns red only when your crosshair targets that player and the hit is within your attack range.

  • Vanilla hitbox rendering is suppressed, removing its blue direction line and red height marker.

  • Added Fabric metadata, client source-set configuration, and Gradle project files. No extra library dependencies are used.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 173
src/client/java/com/kodari/cleanplayerhitbox/PlayerHitboxRenderer.java
package com.kodari.cleanplayerhitbox;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.DrawStyle;
import net.minecraft.client.render.WorldRenderer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.world.debug.gizmo.GizmoDrawing;

public final class PlayerHitboxRenderer {
    private static final DrawStyle NORMAL_STYLE = DrawStyle.stroked(0xFFFFFFFF);
    private static final DrawStyle TARGETED_STYLE = DrawStyle.stroked(0xFFFF0000);

    private PlayerHitboxRenderer() {
    }

    public static void draw(WorldRenderer worldRenderer) {
        MinecraftClient client = MinecraftClient.getInstance();
        if (client.world == null || client.player == null) {
            return;
        }

        PlayerEntity localPlayer = client.player;
        HitResult crosshairTarget = client.crosshairTarget;
        EntityHitResult entityHit = crosshairTarget instanceof EntityHitResult hit ? hit : null;
        boolean canAttackTarget = !localPlayer.isSpectator()
                && entityHit != null
                && !entityHit.getEntity().isSpectator()
                && client.targetedEntity == entityHit.getEntity()
                && localPlayer.getAttackRange().isWithinRange(localPlayer, entityHit.getPos());

        try (GizmoDrawing.CollectorScope ignored = worldRenderer.startDrawingGizmos()) {
            for (AbstractClientPlayerEntity player : client.world.getPlayers()) {
                if (player == localPlayer) {
                    continue;
                }

                boolean targeted = canAttackTarget && entityHit.getEntity() == player;
                GizmoDrawing.box(player.getBoundingBox(), targeted ? TARGETED_STYLE : NORMAL_STYLE);
            }
        }
    }
}