vanshforkodari
๐Ÿ“Ž 1 file 8,529 chars
๐Ÿ“„
pasted-code-1785687970366.txt
txt 203 lines
โ–ถ
ninja strike mod full prompt for kodari new project 


Act as an expert Minecraft Fabric Mod Developer. I am working on a client-side "PvP Combat Optimizer" mod for Minecraft 1.21.11 (Java 21). This mod is designed to help players optimize their combat flow and reduce latency issues by automatically executing attacks when aiming at an entity, while strictly adhering to vanilla game mechanics. 

Here are the core features this mod relies on:
1. Crosshair Execution: It only clicks if the player's crosshair (raycast) is actively hovering over an opponent's hitbox (LivingEntity). 
2. Strict Weapon Filter: It ONLY executes if the player is holding a Sword, Axe, Mace, or Trident. 
3. Strict Pause Checks: It MUST PAUSE all actions if the player is eating, drinking a potion, or blocking with a shield.
4. Vanilla Cooldown Sync: It perfectly respects the vanilla attack speed and only attacks when the cooldown is 100% reset.
5. Crit Favoring: It delays the click slightly if the player is jumping, waiting for the fall to ensure a critical hit.
6. Human-like Delay: It adds a randomized millisecond delay between actions so it feels natural.

I am getting the following compilation errors because the item tags and weapon classes changed in recent Minecraft versions (like 1.21.5+). In 1.21.11, `SwordItem` and `AxeItem` no longer exist, and `ItemTags` moved to a different package.

=== COMPILATION ERRORS ===
Compilation failed with 6 error(s):

ERROR in src/main/java/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java at line 9: package net.minecraft.item.tag does not exist
import net.minecraft.item.tag.ItemTags;
                             ^
ERROR in src/main/java/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java at line 95: cannot find symbol
        return stack.isIn(ItemTags.SWORDS)
                          ^
ERROR in src/main/java/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java at line 96: cannot find symbol
            || stack.isIn(ItemTags.AXES)
                          ^
ERROR in src/main/java/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java at line 95: cannot find symbol
          return stack.isIn(ItemTags.SWORDS)
                            ^
ERROR in src/main/java/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java at line 96: cannot find symbol
              || stack.isIn(ItemTags.AXES)
                            ^
ERROR in src/main/java/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java at line 9: package net.minecraft.item.tag does not exist
  import net.minecraft.item.tag.ItemTags;
                               ^

Please fix these errors and rewrite the necessary files. Specifically, update `TBotController.java` to use the correct `net.minecraft.registry.tag.ItemTags` package and fix the weapon filtering logic. Keep all the original optimization logic exactly the same.

Here are my current project files for context:

--- gradle.properties ---
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true
minecraft_version=1.21.11
yarn_mappings=1.21.11+build.5
loader_version=0.19.2
loom_version=1.14
mod_version=1.0.0
maven_group=com.akgamer4354xdev
archives_base_name=ninjastrike
fabric_version=0.141.4+1.21.11

--- fabric.mod.json ---
{
  "schemaVersion": 1,
  "id": "ninjastrike",
  "version": "${version}",
  "name": "Ninja Strike",
  "description": "A client-side PvP Combat Optimizer that assists with perfect vanilla cooldown sync, weapon filtering, shield/eating pause checks, and crit-favoring timing.",
  "authors": [
    {
      "name": "Akgamer4354Xdev",
      "contact": {
        "homepage": "http://youtube.com/@akgamer1234"
      }
    }
  ],
  "environment": "client",
  "entrypoints": {
    "main": ["com.akgamer4354xdev.ninjastrike.NinjaStrike"],
    "client": ["com.akgamer4354xdev.ninjastrike.NinjaStrikeClient"]
  },
  "depends": {
    "fabricloader": ">=0.19.2",
    "minecraft": "~1.21.11",
    "java": ">=21",
    "fabric-api": "*"
  }
}

--- src/main/java/com/akgamer4354xdev/ninjastrike/NinjaStrike.java ---
package com.akgamer4354xdev.ninjastrike;
import net.fabricmc.api.ModInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class NinjaStrike implements ModInitializer {
    public static final String MOD_ID = "ninjastrike";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
    @Override
    public void onInitialize() {
        LOGGER.info("Ninja Strike initialized");
    }
}

--- src/client/java/com/akgamer4354xdev/ninjastrike/NinjaStrikeClient.java ---
package com.akgamer4354xdev.ninjastrike;
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.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public class NinjaStrikeClient implements ClientModInitializer {
    public static final KeyBinding.Category CATEGORY =
        KeyBinding.Category.create(Identifier.of(NinjaStrike.MOD_ID, "ninja_mods"));
    public static KeyBinding toggleKey;
    @Override
    public void onInitializeClient() {
        toggleKey = KeyBindingHelper.registerKeyBinding(
            new KeyBinding("key.ninjastrike.toggle", GLFW.GLFW_KEY_HOME, CATEGORY)
        );
        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (toggleKey.wasPressed()) {
                TBotController.toggle(client);
            }
            TBotController.tick(client);
        });
    }
}

--- src/client/java/com/akgamer4354xdev/ninjastrike/TBotController.java ---
package com.akgamer4354xdev.ninjastrike;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.AxeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.MaceItem;
import net.minecraft.item.SwordItem;
import net.minecraft.item.TridentItem;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.EntityHitResult;
import java.util.Random;

public final class TBotController {
    private static final Random RANDOM = new Random();
    private static boolean enabled = false;
    private static long nextAllowedClickTime = 0L;
    private TBotController() {
    }
    public static boolean isEnabled() {
        return enabled;
    }
    public static void toggle(MinecraftClient client) {
        enabled = !enabled;
        nextAllowedClickTime = 0L;
        if (client.player != null) {
            Text message = Text.literal("Ninja Strike: ").formatted(Formatting.GRAY)
                .append(Text.literal(enabled ? "ON" : "OFF")
                    .formatted(enabled ? Formatting.GREEN : Formatting.RED));
            client.player.sendMessage(message, true);
        }
    }
    public static void tick(MinecraftClient client) {
        if (!enabled || client.player == null || client.interactionManager == null) {
            return;
        }
        if (client.currentScreen != null) {
            return;
        }
        ClientPlayerEntity player = client.player;
        if (player.isSpectator() || !player.isAlive()) {
            return;
        }
        if (player.isUsingItem() || player.isBlocking()) {
            return;
        }
        if (!isValidWeapon(player.getMainHandStack())) {
            return;
        }
        if (!(client.crosshairTarget instanceof EntityHitResult entityHit)
                || !(entityHit.getEntity() instanceof LivingEntity target)
                || !target.isAlive()
                || target == player) {
            return;
        }
        if (player.getAttackCooldownProgress(0.0F) < 1.0F) {
            return;
        }
        if (!player.isOnGround() && player.getVelocity().y > 0.05D) {
            return;
        }
        long now = System.currentTimeMillis();
        if (now < nextAllowedClickTime) {
            return;
        }
        client.interactionManager.attackEntity(player, target);
        player.swingHand(Hand.MAIN_HAND);
        nextAllowedClickTime = now + 40L + RANDOM.nextInt(81);
    }
    private static boolean isValidWeapon(ItemStack stack) {
        return stack.getItem() instanceof SwordItem
            || stack.getItem() instanceof AxeItem
            || stack.getItem() instanceof MaceItem
            || stack.getItem() instanceof TridentItem;
    }
}
Kodari AI
KodariAug 2 at 4:27 pm 1
NinjaStrike
A client-side Minecraft Fabric PvP combat optimizer that assists with precise vanilla attack timing. It targets the entity under the crosshair, filters attacks to swords, axes, maces, and tridents, pauses while using items or blocking, respects the attack cooldown, favors critical-hit timing, and applies a randomized human-like delay. A toggle keybind and on-screen status message provide direct control while preserving normal client interaction behavior.
  1. Project setup: create the Fabric 1.21.11 Gradle project and metadata.

  2. Combat controller: add the client tick logic with current Yarn weapon-tag filtering and the requested timing checks.

  3. Client entrypoint/resources: register the toggle keybind and required language metadata.

NinjaStrike is a client-side Fabric 1.21.11 PvP combat optimizer that assists attacks while preserving vanilla combat behavior. It targets only living entities under the crosshair, accepts swords, axes, the mace, and the trident, pauses during item use and shield blocking, waits for a full attack cooldown, favors falling critical-hit timing, and applies a randomized human-like delay between attacks. A configurable toggle key provides direct control during gameplay.

Created the complete Fabric 1.21.11 project, including:

  • Gradle and version configuration

  • Main and client entrypoints

  • Correct client source-set layout

  • Updated TBotController

  • Correct net.minecraft.registry.tag.ItemTags import

  • Tag-based sword and axe filtering

  • Direct mace and trident filtering via Items.MACE and Items.TRIDENT

  • Toggle keybind on Home

  • English language translations

  • Fabric mod metadata

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 245
src/client/java/com/akgamer4354xdev/ninjastrike/NinjaStrikeClient.java
package com.akgamer4354xdev.ninjastrike;

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.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public class NinjaStrikeClient implements ClientModInitializer {
    public static final KeyBinding.Category CATEGORY =
        KeyBinding.Category.create(Identifier.of(NinjaStrike.MOD_ID, "ninja_mods"));
    public static KeyBinding toggleKey;

    @Override
    public void onInitializeClient() {
        toggleKey = KeyBindingHelper.registerKeyBinding(
            new KeyBinding("key.ninjastrike.toggle", GLFW.GLFW_KEY_HOME, CATEGORY)
        );

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (toggleKey.wasPressed()) {
                TBotController.toggle(client);
            }
            TBotController.tick(client);
        });
    }
}