not_cvr

Act as an expert Minecraft Java Mod Developer. Create a complete Fabric Hitbox Adjustment Mod for Minecraft Java Edition 1.21.11, designed primarily for multiplayer servers that permit custom hitboxes.

Controls (use ONLY the number keys 8 and 9 on the keyboard's top number row):

  • 9 key: Open a GUI with sliders to increase or decrease hitbox width and height.
  • 8 key: Toggle hitbox adjustment ON/OFF.
  • Do not assign any other keys for these features.
  • Make the hitbox outline visible from the player's camera when enabled.
  • Ensure accurate melee hit detection when attacking with bare hands or any weapon, following the server's authorized combat mechanics.
  • Use configurable, conservative hitbox limits and restore vanilla behavior when disabled.
  • Support multiplayer environments where server-side permissions or compatible server support are available.
  • Never claim that the mod works on every server or guarantees ban protection. Do not bypass anti-cheat, spoof packets, or evade server restrictions.
  • Provide complete build-ready source code, Gradle configuration, Fabric metadata, and installation instructions for Minecraft Java Edition 1.21.11.

Important: Clearly distinguish visual hitbox resizing from actual server-recognized hitbox changes. Explain any server-side requirements and compatibility limitations.

Kodari AI
KodariOct 27 at 11:04 am 8
HitboxAdjuster
A Fabric mod for Minecraft 1.21.11 that lets players visually adjust their hitbox dimensions via a slider GUI (key 9) and toggle the effect (key 8). It renders a visible hitbox outline from the player's camera and modifies local melee hit detection for bare hands and weapons. Conservative configurable limits ensure safe adjustments; vanilla behavior restores when disabled. Designed for servers permitting custom hitboxes, with clear documentation on server-side requirements and limitations—no anti-cheat bypass or packet spoofing.
  1. Implement a client GUI and the 8/9 key controls.

  2. Add an opt-in server companion path that validates bounded changes and synchronizes player hitboxes.

  3. Render adjusted hitboxes and include the 1.21.11 Fabric project metadata and setup instructions.

Created the Fabric 1.21.11 project with Gradle configuration, Fabric metadata, networking, the hitbox mixin, an owo-ui slider screen, and an outline renderer.

  • 9 opens the settings screen; 8 toggles adjustment. The sliders are limited to 0.75×–1.25× vanilla dimensions.

  • Amber outline is a local preview only. Server-recognized changes require the mod on the server and operator permission level 2; accepted dimensions are synchronized to clients tracking that player.

  • The mod leaves melee attacks to vanilla targeting and server checks. It does not spoof attacks or bypass anti-cheat. Other clients need compatible support to target adjusted hitboxes consistently; server plugins or combat mods may conflict. There is no guarantee of compatibility or ban protection.

  • Install the mod bundle on the client and, for server-side changes, the server. Restart, join, then use 9 to adjust and 8 to toggle. README.md has the details; manifest.kod includes owo-lib.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
README.md
settings.gradle
Code
18 700
src/client/java/com/kodari/hitboxadjustment/client/HitboxAdjustmentClient.java
package com.kodari.hitboxadjustment.client;

import com.kodari.hitboxadjustment.HitboxAdjustmentMod;
import com.kodari.hitboxadjustment.network.HitboxPayloads.AdjustmentRequest;
import com.kodari.hitboxadjustment.network.HitboxPayloads.StateUpdate;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public final class HitboxAdjustmentClient implements ClientModInitializer {
    private static final KeyBinding.Category CATEGORY = KeyBinding.Category.create(Identifier.of(HitboxAdjustmentMod.MOD_ID, "controls"));
    private static final KeyBinding OPEN_SETTINGS = KeyBindingHelper.registerKeyBinding(
            new KeyBinding("key.hitboxadjustment.open_settings", GLFW.GLFW_KEY_9, CATEGORY)
    );
    private static final KeyBinding TOGGLE = KeyBindingHelper.registerKeyBinding(
            new KeyBinding("key.hitboxadjustment.toggle", GLFW.GLFW_KEY_8, CATEGORY)
    );

    private static Object observedPlayer;

    @Override
    public void onInitializeClient() {
        ClientPlayNetworking.registerGlobalReceiver(StateUpdate.ID, (payload, context) ->
                ClientHitboxState.handleServerUpdate(payload, context.client()));
        HitboxOutlineRenderer.initialize();
        ClientTickEvents.END_CLIENT_TICK.register(HitboxAdjustmentClient::onEndClientTick);
    }

    private static void onEndClientTick(MinecraftClient client) {
        if (client.player == null || client.world == null) {
            observedPlayer = null;
            ClientHitboxState.beginServerSession();
            return;
        }

        if (observedPlayer != client.player) {
            observedPlayer = client.player;
            ClientHitboxState.beginServerSession();
            if (ClientHitboxState.serverSupportsAdjustments()) {
                ClientPlayNetworking.send(new AdjustmentRequest(true, false, 1.0F, 1.0F));
            }
        }

        if (OPEN_SETTINGS.wasPressed()) {
            client.setScreen(new HitboxSettingsScreen());
        }

        if (TOGGLE.wasPressed()) {
            ClientHitboxState.toggle();
        }
    }
}