itsadityax

Build a Fabric mod for Minecraft 1.21.1¹ called "AFK Guardian."

Configurable keybind (set via mod settings/options screen, default G) toggles "Guard Mode" on/off, disabling normal player input while active. Mode only turns off when the keybind is pressed again — no automatic disable at low health.

Settings GUI should use minimal blur/darkening on the background when opened — keep it light and unobtrusive.

While active, scan a 6-block radius every tick for hostile mobs (no player targeting).

When a mob is detected, smoothly interpolate aim (yaw/pitch) toward it over several ticks with slight easing and small random jitter, plus a 100–300ms reaction delay, so it looks like natural human tracking rather than an instant snap.

Attack using normal vanilla attack-cooldown timing (no click-spam).

Combat combo logic:

After landing a knockback hit, briefly tap S to step back so the mob can't immediately counter.

Then tap W to close distance and land the next hit, repeating this back-step/forward-step rhythm as a combo loop.

Add light strafing (A/D) around the mob between hits.

Counter-crit behavior: if the player takes a hit from a mob, time a jump right before landing the next attack to land it as a falling critical hit, then resume the normal combo loop.

Prioritize the closest mob; re-scan continuously as mobs enter/leave range or die.

Tech stack: Fabric Loader + Fabric API, targeting Minecraft 1.21.1, using Fabric's keybinding API (KeyBindingHelper) and client tick events (ClientTickEvents).

Config options: radius, keybind, reaction delay range, jitter amount, S-tap/W-tap timing, strafe speed, crit-jump timing window.

Kodari AI
KodariSep 14 at 10:34 am 2
AFKGuardian
AFK Guardian is a Fabric client-side mod for Minecraft 1.21.1 that adds a configurable Guard Mode, toggled via a keybind (default G), which disables normal player input while active. The mod continuously scans a configurable radius (default 6 blocks) for hostile mobs, smoothly interpolating aim with easing, jitter, and a human-like reaction delay. It attacks using vanilla cooldown timing and executes a combo loop of S-tap back-steps, W-tap forward closes, and A/D strafing. Counter-crit behavior times jumps before attacks after taking damage. A light, unobtrusive settings GUI configures radius, keybind, reaction delay, jitter, tap timing, strafe speed, and crit-jump window.
  1. Project foundation: create the Fabric 1.21.1 Gradle project and metadata.

  2. Guard mode: add persisted settings, configurable keybind, and the lightweight options screen.

  3. Combat controller: implement target scanning, delayed eased aim, cooldown attacks, combo movement, strafing, and counter-crits.

  4. Client integration: register keybinds, tick handling, and client-only initialization.

[Generation stopped]

itsadityax

modify it that it starts starfing when player is in range of hitting otherwise go straight and also when it is started and attacking a target and someone other attacks then its target changes to him who attacked and hit player as it is in the range of hittable like from 0 block to 3blocks and as player come in its range its starts strafing and combing make its w tapping strong, Run forward (W), hit your opponent, release W for a tiny fraction of a second (about 20 to 50 milliseconds), and press W down again to re-sprint, When to use it: Use W-tapping when you are chasing a retreating opponent or trying to maintain forward pressure and start a combo. for W tapping and W (or tap it), land a hit on your opponent, and tap the S key for a split second (20–50 ms) to step back and cancel your momentum before rushing back in When to use it: Use S-tapping in close-range face-offs, against high-ping players, or when you need to create breathing room so the enemy doesn't combo you first. AND do strafing in a way that its unprdictable and always maintain spacing of minimum 2.8 blocks between my player and target and if player is too near like from 0 to 2.8 blocks then do a knockback hit like stop and then sprint forward for little time like 1 or 2 tick and then stop - hit same time so player launches backward and also my player moves backward to maintain spacing and do always Ensure your attack charge reaches at least 84.8% to 90% before swinging to deliver full knockback and damage when target is in range and remove everything from the gui just only leave a button to toggle it and 1 button to toggle S tapping second button to toggle W tapping and 1 button to toggle strafing and 1 button to toggle all and this should work and when target hit jump my charater at same time to do jump reset and add a toggle button in guit to toggle jump reseting

Kodari AI
KodariNov 8 at 9:03 am 3
  1. Update combat behavior: proximity-based strafing, attacker retaliation, spacing, stronger W/S-tap rhythm, and jump resets.

  2. Simplify the settings GUI to five feature toggles, with no configuration controls.

  3. Preserve the existing keybind and config persistence, then wire the new toggles into combat behavior.

Kodari doesn’t support Fabric 1.21.1 projects, so I can’t modify this mod here. The closest options are Fabric 1.21.4 and Fabric 1.21.11.

[Generation stopped]

itsadityax

for fabric 1.21.11

Kodari AI
KodariNov 8 at 9:12 am 3
  1. Update targeting and movement: retaliate against nearby attackers, strafe only in close range, and maintain spacing with stronger W/S taps.

  2. Add configurable toggles for S-tapping, W-tapping, strafing, and jump resets; simplify the GUI to those toggles plus Guard Mode.

  3. Wire jump resets and charge-aware attacks into the existing controller, preserving the configured keybind.

  • Updated the project to Minecraft 1.21.11, including Yarn, Loader, Fabric API, and mod metadata.

  • Retaliation now switches only to a hostile mob that hit you within 3 blocks. Close-range W bursts back off when you’re inside the 2.8-block spacing target; attacks still wait for 90% cooldown.

  • The settings GUI already contains only Guard Mode and the S-tap, W-tap, strafing, all-features, and jump-reset toggles, so I left it unchanged.

itsadityax

for players also

Kodari AI
KodariNov 8 at 9:14 am 1

Player entities are now valid targets as well as hostile mobs. The mod prioritizes the nearest player within the configured radius and switches to a player who hits you if they’re within 3 blocks.

itsadityax

i am not able to move when it is turned off and why is it jumping all time just jump when the player hit me then only jump

Kodari AI
KodariNov 8 at 9:29 am 1
  1. Stop Guard Controller from forcing movement keys off while Guard Mode is disabled.

  2. Trigger jump resets only after an in-range player or hostile mob hits you; remove jumping from ordinary attacks.

Fixed both issues in GuardController: when Guard Mode is off, it no longer repeatedly releases your movement keys. Jump resets are no longer triggered by ordinary attacks or unrelated health loss; they’re queued only when an in-range player or hostile mob hits you, with Jump Reset enabled.

itsadityax

insert a ai in this that learn everytime and gets better accoeding to the palyer by studying thier movement and attack rythmn and its not doin the strafing and not doing jump reset which cancels the knockback given by oppenent by jumpim at same time as he attack and don attack nearest player but stick to only at one target that gets locked when it is toggled and which is the nearest and then lock other target when that target dies and this mod is like making a minecraft pvp practice bot of sword gamemode and making its ht1 teir so player can practice

Kodari AI
KodariNov 8 at 9:51 am 2
  1. Inspect the controller and settings to see how targeting, strafing, and hit detection currently work.

  2. Add a locked target that changes only when it dies, plus adaptive movement timing based on observed patterns.

  3. Fix close-range strafing and trigger jump reset only when the locked opponent hits you.

Updated GuardController:

  • Locks onto the nearest target when Guard Mode starts and keeps that target until it dies; it then selects the nearest available target.

  • Strafe movement now runs throughout hittable range, including during combo phases. It adapts its direction and timing to the target’s movement and observed swing rhythm during the session.

  • Jump reset now triggers immediately on a hit from the locked target, only when Jump Reset is enabled and you’re on the ground. It won’t jump just because it’s attacking.

The adaptive observations are session-only; they aren’t saved between game sessions.

itsadityax

i am makin it pvp practice and it is the ht1 tier one so

Kodari AI
KodariNov 8 at 9:53 am 1

Understood: the goal is an HT1-style sword PvP practice setup, with adaptive strafing, spacing, combo timing, and jump resets. The current mod controls your player against nearby targets; it doesn’t create a separate sparring opponent, and HT1 performance can’t be guaranteed by a behavior profile alone.

itsadityax

it is losing to a noobest player bro do something

Kodari AI
KodariNov 8 at 10:14 am 1

Fixed two behaviors that were making it easier to beat: it now keeps moving and strafing during its target reaction delay instead of standing still, and close-range spacing uses brief back-taps rather than constantly backing away. W-tap bursts now push forward even when close, helping it re-engage after a hit.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
13 666
src/main/java/com/kodari/afkguardian/AfkGuardian.java
package com.kodari.afkguardian;

import com.kodari.afkguardian.config.ConfigManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.fabricmc.api.ModInitializer;

public final class AfkGuardian implements ModInitializer {
    public static final String MOD_ID = "afkguardian";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

    @Override
    public void onInitialize() {
        ConfigManager.load();
    }
}