Emil Fagerberg

Make a mod for fabric that open chat and writes in chat "/pay Feral1 100m" 5 times a second. Dont make the repeater stop until after 10 seconds. make it start on a keybind "R"

Kodari AI
KodariSep 11 at 5:04 am 1
AutoPaySpammer
AutoPaySpammer is a Fabric mod for Minecraft 1.21.1 that automates sending the chat command "/pay Feral1 100m" repeatedly. When the player presses the R keybind, the mod opens the chat interface and sends the specified command five times per second for a total duration of ten seconds, then automatically stops. The mod registers a custom keybinding, tracks the active sending state, and uses a tick-based scheduler to dispatch chat messages at the configured rate. It provides a simple toggle system where pressing R starts the automated payment sequence, and the sequence halts after the elapsed time expires. The mod is lightweight, client-side only, and integrates seamlessly with the Fabric mod loader.

Created the Fabric 1.21.11 client mod.

  • Press R to activate the macro.

  • Opens chat with /pay Feral1 100m.

  • Sends the command 5 times per second.

  • Runs continuously for 10 seconds.

  • Added complete Gradle/Fabric project setup and keybind translation.

Emil Fagerberg

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/client/java/com/kodari/paymacro/PayMacroClient.java at line 62: constructor ChatScreen in class ChatScreen cannot be applied to given types;
        client.setScreen(new ChatScreen(COMMAND));
                         ^

ERROR in   src/main/java/client/java/com/kodari/paymacro/PayMacroClient.java at line 62: constructor ChatScreen in class ChatScreen cannot be applied to given types;
          client.setScreen(new ChatScreen(COMMAND));
                           ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/kodari/paymacro/PayMacroClient.java
  -   src/main/java/client/java/com/kodari/paymacro/PayMacroClient.java

Please fix this error by creating a new artifact with the corrected code.

Kodari AI
KodariSep 11 at 5:09 am 2

I’m unable to modify the project artifact in this turn. The required fix is:

Java
client.setScreen(new ChatScreen(COMMAND, false));

Replace line 62 in:

Plain Text
src/client/java/com/kodari/paymacro/PayMacroClient.java

The second argument supplies the chat draft mode required by the current Minecraft version.

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

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

public class PayMacroClient implements ClientModInitializer {
    private static final String COMMAND = "/pay Feral1 100m";
    private static final int TOTAL_TICKS = 20 * 10;
    private static final int TICKS_BETWEEN_COMMANDS = 4;

    private static final KeyBinding PAY_KEY = KeyBindingHelper.registerKeyBinding(new KeyBinding(
            "key.paymacro.start",
            GLFW.GLFW_KEY_R,
            KeyBinding.Category.create(Identifier.of("paymacro", "main"))
    ));

    private int activeTicks;
    private int ticksUntilNextCommand;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(this::onClientTick);
    }

    private void onClientTick(MinecraftClient client) {
        while (PAY_KEY.wasPressed()) {
            startMacro(client);
        }

        if (activeTicks <= 0) {
            return;
        }

        if (client.player == null || client.world == null) {
            activeTicks = 0;
            return;
        }

        if (ticksUntilNextCommand == 0) {
            client.player.networkHandler.sendChatCommand("pay Feral1 100m");
            ticksUntilNextCommand = TICKS_BETWEEN_COMMANDS;
        }

        activeTicks--;
        ticksUntilNextCommand--;
    }

    private void startMacro(MinecraftClient client) {
        if (client.player == null || client.world == null) {
            return;
        }

        activeTicks = TOTAL_TICKS;
        ticksUntilNextCommand = 0;
        client.setScreen(new ChatScreen(COMMAND));
    }
}