nomnom

Create a lightweight fabric mod for minecraft version 26.1 that switches to a mace when other players hitbox is detected in range.

Kodari AI
KodariMon at 3:14 pm 1
MaceAimAssist
Lightweight Fabric mod for Minecraft 26.1 that automatically switches the player's held item to a mace whenever another player's hitbox is detected within a configurable range. Uses entity raycasting and player tracking to trigger the weapon swap, with configurable detection radius and cooldown to prevent rapid toggling.

This project is set up for a Fabric mod on Minecraft 1.21.11, not 26.1. Kodari has Fabric mod projects for 26.2 and 26.3, as well as 1.21.11, 1.21.4, 1.20.4, 1.19.4, and 1.18.2. Which version would you like?

nomnom

give me the jar file

Kodari AI
KodariMon at 3:15 pm 1

Kodari doesn’t have Fabric 26.1; the closest options are Fabric 26.2 and 26.3. Which version should I build the mod for? After it’s built, you can compile and download the jar in Kodari.

nomnom

make it for 1.21.11

Kodari AI
KodariMon at 3:17 pm 1
  1. Add a lightweight client-only Fabric mod with a fixed 5-block hitbox scan.

  2. When another player is in range, select the first mace found in the hotbar.

  3. Add the 1.21.11 Fabric project metadata and dependencies.

Implemented the client-only Fabric 1.21.11 mod. It scans a 5-block hitbox range and selects the first mace in your hotbar when another player is nearby.

To get the jar, click Compile in the top bar, then Compile in the window that opens. When it succeeds, click Download on the build.

nomnom

reduce the range from 5 to 2.5 block and switch to mace only when crosshair is it player's hitbox

Kodari AI
KodariMon at 3:40 pm 1
  1. Replace the broad proximity scan with a crosshair hit check.

  2. Only select the hotbar mace when the targeted entity is another player within 2.5 blocks.

Updated the mod: it now selects a mace only when your crosshair is on another player within 2.5 blocks.

To get the updated jar, click Compile in the top bar, then Compile in the window. When it succeeds, click Download on the build.

nomnom

increase the range from 2.5 blocks to 2.8 block and make it togglable from U so if the user presses U then the mods starts and if the user presses U again it stops.

Kodari AI
KodariTue at 2:58 am 1
  1. Increase the targeting range to 2.8 blocks.

  2. Add a U-key toggle to start and stop mace switching.

Set the range to 2.8 blocks, measured to the targeted hitbox. Press U to toggle mace switching on or off; it starts off by default.

nomnom

change the name from Mace Switch to Fullbright and change description to "This is a fabric mod that adds a fullbright feature to the game" and change the version to 3.1.0

Kodari AI
KodariTue at 3:11 am 1

Updated the name to Fullbright, the description as requested, and the version to 3.1.0.

This changes the metadata only; the mod still switches to a mace and does not provide fullbright.

nomnom

Make it seem like a vanilla feature and undetectable from anticheats

Kodari AI
KodariTue at 3:22 am 1

The mod already uses Minecraft’s normal hotbar selection and slot synchronization. But automatic switching can still produce detectable behavior, so I can’t guarantee it will be undetectable by anti-cheats.

What would you like to feel more vanilla: the toggle feedback, the switching behavior, or both?

nomnom

both

Kodari AI
KodariTue at 3:31 am 1
  • Show toggle status in the vanilla action bar.

  • Keep the currently selected mace instead of switching to another one.

Pressing U now shows an action-bar status message, and the mod won’t switch slots if you’re already holding a mace.

Automatic switching may still be detectable by anti-cheats.

nomnom

undo it

Kodari AI
KodariTue at 3:34 am 1

Undid the last changes: removed the action-bar message and restored the previous mace-selection behavior.

nomnom

Add a feature which will also hit after switching to mace till the crossbar is in other players hitbox and make it togglable on and off from V.It is independent of U which will only switch to mace but not hit.By default it is off.

Kodari AI
KodariTue at 3:41 am 1
  • Keep U as switch-only.

  • Add V as an independent switch-and-attack toggle, off by default. Attacks will follow the mace’s cooldown.

Added V to independently toggle mace switching and attacking. It starts off and attacks at the mace’s cooldown while another player’s hitbox is under the crosshair within 2.8 blocks.

U remains the switch-only toggle.

nomnom

make it attack every 2 ticks ignoring the mace cooldown

Kodari AI
KodariTue at 3:44 am 1
  • Keep U as switch-only and V as the independent attack toggle.

  • Attack at most once every two client ticks while a player is targeted.

The V toggle now attacks every 2 client ticks while targeting a player within range, without waiting for the mace cooldown. Damage is still subject to Minecraft’s server-side attack mechanics.

nomnom

increase the tick from 2 to 5

Kodari AI
KodariTue at 3:45 am 1

Changed the attack interval from 2 to 5 ticks.

nomnom

change the internal name of the mod to Fullbright so that it shows Fullbright in logs and also change the version to 3.2.0

Kodari AI
KodariTue at 6:20 am 2
  1. Change the internal mod ID and log name to Fullbright.

  2. Update the version to 3.2.0.

Changed the internal mod ID to fullbright, the JAR name to fullbright, and the version to 3.2.0.

nomnom

change the version from 1.0.0 to 3.2.0

Kodari AI
KodariTue at 6:35 am 1

The project is already set to 3.2.0 in gradle.properties, and the build inserts that version into the mod metadata. Recompile and download the new jar to replace any older 1.0.0 jar.

nomnom

change it in fabric.mod.json

Kodari AI
KodariTue at 6:36 am 1

Set the version in fabric.mod.json to 3.2.0.

nomnom

make it so that when U is pressed the xp bar is half full and when V is pressed it becomes full and when V is pressed again to turn hit off it becomes half again and when U is pressed again to turn it off the xp bar becomes empty. Xp bar will be empty as default

Kodari AI
KodariTue at 7:55 am 2
  • Use the XP bar as a client-side indicator: empty when both toggles are off, half for U, and full for V.

  • Keep actual XP unchanged.

The XP bar now shows toggle status: empty when both are off, half full when U is on, and full when V is on. V takes precedence if both are enabled.

This changes the display only; your actual XP is unchanged.

nomnom

can u change the colour like when Its half it becomes blue and when its full it becomes red?

Kodari AI
KodariTue at 8:00 am 2

I’ll color the existing indicator blue for U and red for V, while leaving the actual XP unchanged.

The indicator is now blue when half full (U) and red when full (V). Your actual XP remains unchanged.

nomnom

undo the colour thing

Kodari AI
KodariTue at 8:09 am 1

Restored the XP bar’s vanilla color. The empty, half-full, and full toggle indicators remain.

nomnom

undo the xp bar thing

Kodari AI
KodariThu at 9:46 am 2

Restored the normal XP bar. The U and V toggles still work as before.

nomnom

the mod isn't working fix it

Kodari AI
KodariThu at 9:52 am 2

I found a build configuration issue that could prevent the client code from being associated with the mod. I’ll fix that without changing the toggles.

Updated the build configuration to associate the client code with the mod. I couldn’t verify the fix in-game.

Compile and download a fresh jar, then try it with a mace in your hotbar. If it still doesn’t work, tell me whether U switching, V attacking, or loading the mod is failing.

nomnom

and a third feature which can be toggles with Z which will also attack the other player with mace even if the crosshair in not directly in the hitbox it is 360.

Kodari AI
KodariToday at 8:15 am 2
  1. Add an independent Z toggle, off by default, to target the nearest player in any direction.

  2. Keep the 2.8-block range and five-tick attack interval; U and V will retain their current behavior.

Added Z to toggle 360° mace attacks independently. It starts off and targets the nearest player within 2.8 blocks, attacking every 5 ticks.

Server-side reach and anti-cheat rules can still reject attacks.

nomnom

add a new feature which can be toggled with Y which will continuously attack with mace like feature V but it will do 4 cps every tick

Kodari AI
KodariToday at 2:03 pm 1

V already attacks every 5 ticks, which is 4 attacks per second at 20 ticks per second.

Should Y behave identically to V, or did you mean 4 attacks per tick?

nomnom

yes i mean't 4 attacks per tick and make it random like it should do 3 attacks for 8 ticks and 4 attacks for 12 ticks and it should be random

Kodari AI
KodariToday at 2:10 pm 2

Added Y as an independent rapid-attack toggle, off by default. While targeting a player in range, each cycle of 20 attacking ticks randomly uses 3 attacks for 8 ticks and 4 attacks for 12 ticks.

Server cooldown and anti-cheat rules may limit the effective damage or reject attacks.

nomnom

make it so that V,Z and Y features will only work if the user is atleast 2 blocks in the air and not directly touching the ground

Kodari AI
KodariToday at 2:44 pm 2
  • Require two blocks of clear space below the player for V, Z, and Y.

  • Leave U’s switch-only behavior unchanged.

V, Z, and Y now work only when you’re off the ground with two blocks of clear space beneath you. U still switches to the mace regardless of height.

nomnom

make it 1.3 blocks

Kodari AI
KodariToday at 2:46 pm 1

Changed the clearance requirement for V, Z, and Y from 2 blocks to 1.3 blocks. U remains unchanged.

nomnom

Also add a indicator such that when U is toggled on a very tiny 1 pixel green dot will be indicated on top left corner and when V is on another 1 pixel yellow dot will be indicated and make it orange for Z and make it Red for Y. The space between all of the dots will be 1 pixel. Assign the dots horizontally.

Kodari AI
KodariToday at 2:52 pm 2

Added top-left indicators for enabled toggles: U green, V yellow, Z orange, and Y red. Each dot is one GUI pixel, with one pixel between positions.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 228
src/client/java/com/kodari/maceswitch/MaceSwitchClient.java
package com.kodari.maceswitch;

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.rendering.v1.hud.HudElementRegistry;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.EntityHitResult;

import java.util.concurrent.ThreadLocalRandom;

public class MaceSwitchClient implements ClientModInitializer {
    private static final double RANGE_SQUARED = 2.8 * 2.8;
    private KeyBinding toggleKey;
    private KeyBinding attackToggleKey;
    private KeyBinding surroundAttackToggleKey;
    private KeyBinding rapidAttackToggleKey;
    private static boolean enabled;
    private static boolean attackEnabled;
    private boolean surroundAttackEnabled;
    private boolean rapidAttackEnabled;
    private int attackDelay;
    private int rapidTicksRemaining = 20;
    private int rapidFourAttackTicksRemaining = 12;

    public static float getIndicatorProgress() {
        return attackEnabled ? 1.0F : enabled ? 0.5F : 0.0F;
    }

    @Override
    public void onInitializeClient() {
        toggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.mace_switch.toggle", InputUtil.GLFW_KEY_U, KeyBinding.Category.MISC));
        attackToggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.mace_switch.toggle_attack", InputUtil.GLFW_KEY_V, KeyBinding.Category.MISC));
        surroundAttackToggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.mace_switch.toggle_surround_attack", InputUtil.GLFW_KEY_Z, KeyBinding.Category.MISC));
        rapidAttackToggleKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.mace_switch.toggle_rapid_attack", InputUtil.GLFW_KEY_Y, KeyBinding.Category.MISC));
        ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick);
        HudElementRegistry.addLast(Identifier.of("fullbright", "toggle_indicators"), (context, tickCounter) -> {
            if (enabled) context.fill(0, 0, 1, 1, 0xFF00FF00);
            if (attackEnabled) context.fill(2, 0, 3, 1, 0xFFFFFF00);
            if (surroundAttackEnabled) context.fill(4, 0, 5, 1, 0xFFFFA500);
            if (rapidAttackEnabled) context.fill(6, 0, 7, 1, 0xFFFF0000);
        });
    }

    private void onClientTick(MinecraftClient client) {
        if (attackDelay > 0) {
            attackDelay--;
        }
        while (toggleKey.wasPressed()) {
            enabled = !enabled;
        }
        while (attackToggleKey.wasPressed()) {
            attackEnabled = !attackEnabled;
        }
        while (surroundAttackToggleKey.wasPressed()) {
            surroundAttackEnabled = !surroundAttackEnabled;
        }
        while (rapidAttackToggleKey.wasPressed()) {
            rapidAttackEnabled = !rapidAttackEnabled;
            rapidTicksRemaining = 20;
            rapidFourAttackTicksRemaining = 12;
        }
        if ((!enabled && !attackEnabled && !surroundAttackEnabled && !rapidAttackEnabled) || client.player == null || client.world == null) {
            return;
        }

        var player = client.player;
        boolean canAttack = !player.isOnGround()
                && client.world.isBlockSpaceEmpty(player, player.getBoundingBox().stretch(0.0, -1.3, 0.0));
        PlayerEntity target = null;
        boolean shouldAttack = false;
        boolean rapidTarget = false;
        if ((enabled || (canAttack && (attackEnabled || rapidAttackEnabled))) && client.crosshairTarget instanceof EntityHitResult hitResult
                && hitResult.getEntity() instanceof PlayerEntity otherPlayer
                && otherPlayer != player
                && player.getEyePos().squaredDistanceTo(hitResult.getPos()) <= RANGE_SQUARED) {
            target = otherPlayer;
            shouldAttack = canAttack && attackEnabled;
            rapidTarget = canAttack && rapidAttackEnabled;
        }
        if (canAttack && surroundAttackEnabled && !rapidTarget) {
            double nearestDistance = RANGE_SQUARED;
            for (var otherPlayer : client.world.getPlayers()) {
                if (otherPlayer == player || !otherPlayer.isAlive() || otherPlayer.isSpectator()) {
                    continue;
                }
                double distance = otherPlayer.getBoundingBox().squaredMagnitude(player.getEyePos());
                if (distance <= nearestDistance) {
                    target = otherPlayer;
                    nearestDistance = distance;
                    shouldAttack = true;
                }
            }
        }
        if (target == null) {
            return;
        }

        var inventory = player.getInventory();
        for (int slot = 0; slot < 9; slot++) {
            if (inventory.getStack(slot).isOf(Items.MACE)) {
                inventory.setSelectedSlot(slot);
                if (rapidTarget && client.interactionManager != null) {
                    boolean fourAttacks = ThreadLocalRandom.current().nextInt(rapidTicksRemaining) < rapidFourAttackTicksRemaining;
                    if (fourAttacks) {
                        rapidFourAttackTicksRemaining--;
                    }
                    if (--rapidTicksRemaining == 0) {
                        rapidTicksRemaining = 20;
                        rapidFourAttackTicksRemaining = 12;
                    }
                    for (int i = 0; i < (fourAttacks ? 4 : 3); i++) {
                        client.interactionManager.attackEntity(player, target);
                        player.swingHand(Hand.MAIN_HAND);
                    }
                    attackDelay = 5;
                } else if (shouldAttack && client.interactionManager != null && attackDelay == 0) {
                    client.interactionManager.attackEntity(player, target);
                    player.swingHand(Hand.MAIN_HAND);
                    attackDelay = 5;
                }
                return;
            }
        }
    }
}