Build the requested client-side Fabric mod in this empty project. Mod name/id: WindchargeLauncher / windchargelauncher. Target Minecraft Java 1.21.11, Java, Fabric API; use the project's existing template/version catalog and valid 1.21.11 mappings. Requirements: keybind named “Windcharge Launch”, default G; on press find wind charge in hotbar, select it, aim toward ground near player's feet, and trigger a normal legitimate throw using available client APIs/input; restore prior hotbar slot after the throw. Add configurable delay between actions and a cooldown/anti-repeat guard. Provide an in-game configuration screen if feasible using vanilla/Fabric screen APIs, with settings for delay/cooldown and keybind documented/configurable through Controls. Include complete Java source, fabric.mod.json, Gradle files as needed, and concise installation/build instructions in project documentation. Inspect the real project template and valid Minecraft 1.21.11/Fabric API/mappings symbols before coding; do not invent methods. Keep behavior client-only and do not forge server responses or bypass validation. Implement the feature code only; do not add tests. When done, summarize files and settings, and state any limitations.

Kodari AI
KodariOct 25 at 10:16 am 2
WindchargeLauncher
Client-side Fabric mod for Minecraft 1.21.11 that adds a configurable keybind (default G) to automatically select a wind charge from the hotbar, aim toward the ground near the player's feet, throw it using legitimate client input, then restore the previous hotbar slot. Includes configurable delay/cooldown settings and an in-game configuration screen.
  1. Confirm the 1.21.11 keybinding, tick, inventory, and legitimate item-use APIs.

  2. Create the client-only Fabric project, action/cooldown logic, and configurable settings.

  3. Add concise project/build documentation and note the aim/throw limitations.

Created the client-only Windcharge Launcher project for Fabric 1.21.11.

  • Controls: “Windcharge Launch,” default G, configurable under Options → Controls. It finds a hotbar wind charge, uses the normal item interaction while aiming 75° downward, then restores the prior slot and pitch.

  • Settings: The Mod Menu configuration screen offers an action delay of 0–20 ticks (default 2) and cooldown of 1–200 ticks (default 30). Settings save to config/windchargelauncher.properties.

  • Project files: Added the client source, YACL/Mod Menu integration, Fabric metadata, Gradle setup with a version catalog, dependency manifest, English keybind labels, and README installation/build instructions.

  • Limitations: The aim angle is fixed; launching consumes a wind charge and remains subject to server validation. Actions are ignored while a screen is open or when there’s no wind charge in the hotbar.

Kodari can make mistakes. Review important code before using.
Files
gradle
src
build.gradle
gradle.properties
manifest.kod
README.md
settings.gradle
Code
12 341
src/client/java/com/kodari/windchargelauncher/WindchargeLauncherClient.java
package com.kodari.windchargelauncher;

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.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;

public final class WindchargeLauncherClient implements ClientModInitializer {
    private static final String MOD_ID = "windchargelauncher";
    private static final float DOWNWARD_PITCH = 75.0F;

    private static KeyBinding launchKey;
    private static int delayRemaining;
    private static int cooldownRemaining;
    private static boolean pendingLaunch;

    @Override
    public void onInitializeClient() {
        LauncherConfig.load();

        KeyBinding.Category category = KeyBinding.Category.create(Identifier.of(MOD_ID, "controls"));
        launchKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.windchargelauncher.launch",
                InputUtil.Type.KEYSYM,
                InputUtil.GLFW_KEY_G,
                category
        ));

        ClientTickEvents.END_CLIENT_TICK.register(WindchargeLauncherClient::onClientTick);
    }

    private static void onClientTick(MinecraftClient client) {
        boolean pressed = launchKey.wasPressed();
        if (cooldownRemaining > 0) {
            cooldownRemaining--;
        }

        if (client.currentScreen != null || client.player == null || client.interactionManager == null) {
            pendingLaunch = false;
            return;
        }

        if (pendingLaunch) {
            if (delayRemaining > 0) {
                delayRemaining--;
            }
            if (delayRemaining == 0) {
                pendingLaunch = false;
                launch(client);
            }
            return;
        }

        if (pressed && cooldownRemaining == 0) {
            delayRemaining = LauncherConfig.actionDelayTicks;
            if (delayRemaining == 0) {
                launch(client);
            } else {
                pendingLaunch = true;
            }
        }
    }

    private static void launch(MinecraftClient client) {
        if (client.player == null || client.interactionManager == null) {
            return;
        }

        PlayerInventory inventory = client.player.getInventory();
        int windChargeSlot = -1;
        for (int slot = 0; slot < 9; slot++) {
            ItemStack stack = inventory.getStack(slot);
            if (stack.isOf(Items.WIND_CHARGE)) {
                windChargeSlot = slot;
                break;
            }
        }
        if (windChargeSlot < 0) {
            return;
        }

        int previousSlot = inventory.getSelectedSlot();
        float previousPitch = client.player.getPitch();
        try {
            inventory.setSelectedSlot(windChargeSlot);
            client.player.setPitch(DOWNWARD_PITCH);
            client.interactionManager.interactItem(client.player, Hand.MAIN_HAND);
            cooldownRemaining = LauncherConfig.cooldownTicks;
        } finally {
            client.player.setPitch(previousPitch);
            inventory.setSelectedSlot(previousSlot);
        }
    }
}