voreixz

Can you make a 1.21.11 fabric mod where you can make your own macro's

Kodari AI
KodariAug 21 at 7:43 am 2

I’ll build a client-side macro mod with:

  1. /macro commands to create, bind, list, remove, and run macros.

  2. Ordered actions for chat messages and client key presses.

  3. Persistent JSON storage in the client config directory.

  4. Five configurable macro slots with keybindings and a simple recording workflow.

Created a Fabric 1.21.11 client-side macro mod.

Features:

  • Create macros with /macro create <name>

  • Add chat messages:

    • /macro add <name> chat <message>

  • Add server commands:

    • /macro add <name> command <command>

  • Add delays in ticks:

    • /macro add <name> wait <ticks>

  • Run, stop, list, delete, bind, and unbind macros

  • Bind up to five macros to F6–F10 by default

  • Change keybinds through Minecraft’s Controls menu

  • Automatically saves macros to config/kodari_macros.json

Example:

Plain Text
/macro create greet
/macro add greet chat Hello everyone!
/macro add greet wait 20
/macro add greet command say Welcome to the server
/macro bind greet 1

Press F6 to run the bound macro.

voreixz

can you just make a clickgui with smooth animations and u can open it by clicking right shift

Kodari AI
KodariAug 21 at 7:45 am 1
  1. Add a Right Shift keybinding that toggles the macro GUI.

  2. Add an animated macro screen with create, run, bind/unbind, delete, and stop controls.

  3. Keep the existing command-based macro system and persist all changes as before.

Added a smooth animated macro ClickGUI.

  • Opens and closes with Right Shift

  • Animated panel slide-in and fade-in

  • Create macros directly in the GUI

  • Run macros

  • Bind/unbind macros to F6–F10

  • Delete macros

  • Stop running macros

  • Displays action counts and bound slots

  • Keeps existing /macro commands and JSON persistence

The Right Shift keybind can also be changed in Minecraft’s Controls menu.

voreixz

The compilation failed with this error:

code
Compilation failed with 2 error(s):

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroCommands.java at line 134: ')' or ',' expected
        ));
          ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroCommands.java at line 134: ')' or ',' expected
          ));
            ^


=== COMPILATION ERROR ANALYSIS ===

SYNTAX ERRORS:
  - Line 134: ')' or ',' expected
  - Line 134: ')' or ',' expected
ACTION: Check for missing semicolons or brackets

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/kodari/macros/client/MacroCommands.java
  -   src/main/java/client/java/com/kodari/macros/client/MacroCommands.java

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

Kodari AI
KodariAug 21 at 10:15 am 1

Fixed the compilation error in MacroCommands.java.

The wait-action command chain was missing one closing parenthesis. The corrected artifact is now at:

Plain Text
src/client/java/com/kodari/macros/client/MacroCommands.java

This also matches the correct Fabric split source-set path; the reported src/main/java/client/java/... path was incorrect.

voreixz

The compilation failed with this error:

code
Compilation failed with 18 error(s):

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 58: incompatible types: String cannot be converted to Text
            ButtonWidget bindButton = ButtonWidget.builder(bindLabel(macro), button -> bindMacro(macro))
                                                                    ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 92: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
        context.drawText(textRenderer, Text.literal("Create and control your client-side macros"),
               ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 96: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
            context.drawText(textRenderer, Text.literal("No macros yet. Create one above or use /macro create."),
                   ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 99: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
            context.drawText(textRenderer, Text.literal("Saved macros"),
                   ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 110: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
                context.drawText(textRenderer, Text.literal(details),
                       ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 114: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
                context.drawText(textRenderer,
                       ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 120: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
        context.drawText(textRenderer, Text.literal("Right Shift toggles this menu"),
               ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 125: method does not override or implement a method from a supertype
    @Override
    ^

ERROR in src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 131: method keyPressed in class Screen cannot be applied to given types;
        return super.keyPressed(keyCode, scanCode, modifiers);
                    ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 131: method keyPressed in class Screen cannot be applied to given types;
          return super.keyPressed(keyCode, scanCode, modifiers);
                      ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 92: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
          context.drawText(textRenderer, Text.literal("Create and control your client-side macros"),
                 ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 96: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
              context.drawText(textRenderer, Text.literal("No macros yet. Create one above or use /macro create."),
                     ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 99: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
              context.drawText(textRenderer, Text.literal("Saved macros"),
                     ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 110: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
                  context.drawText(textRenderer, Text.literal(details),
                         ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 114: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
                  context.drawText(textRenderer,
                         ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 120: no suitable method found for drawText(TextRenderer,MutableText,int,int,int)
          context.drawText(textRenderer, Text.literal("Right Shift toggles this menu"),
                 ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 58: incompatible types: String cannot be converted to Text
              ButtonWidget bindButton = ButtonWidget.builder(bindLabel(macro), button -> bindMacro(macro))
                                                                      ^

ERROR in   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java at line 125: method does not override or implement a method from a supertype
      @Override
      ^


=== COMPILATION ERROR ANALYSIS ===

TYPE MISMATCHES:
  - incompatible types: String cannot be converted to Text
  - incompatible types: String cannot be converted to Text
ACTION: Fix variable types or casting

FILES TO INVESTIGATE:
  - src/main/java/client/java/com/kodari/macros/client/MacroScreen.java
  -   src/main/java/client/java/com/kodari/macros/client/MacroScreen.java

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

Kodari AI
KodariAug 21 at 10:17 am 1

Fixed MacroScreen.java:

  • Wrapped the bind button label with Text.literal(...).

  • Changed DrawContext.drawText(...) calls to use String.

  • Updated the keyboard handler to the 1.21.11 KeyInput signature.

  • Preserved Right Shift and Escape closing behavior.

Corrected artifact:

Plain Text
src/client/java/com/kodari/macros/client/MacroScreen.java
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
12 831
src/client/java/com/kodari/macros/KodariMacrosClient.java
package com.kodari.macros;

import com.kodari.macros.client.MacroCommands;
import com.kodari.macros.client.MacroManager;
import com.kodari.macros.client.MacroScreen;
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 KodariMacrosClient implements ClientModInitializer {
    private static final KeyBinding.Category CATEGORY = KeyBinding.Category.create(
        Identifier.of(KodariMacros.MOD_ID, "macros")
    );
    private static final KeyBinding OPEN_GUI_KEY = KeyBindingHelper.registerKeyBinding(new KeyBinding(
        "key.kodari_macros.open_gui",
        GLFW.GLFW_KEY_RIGHT_SHIFT,
        CATEGORY
    ));
    private static final KeyBinding[] SLOT_KEYS = new KeyBinding[5];

    @Override
    public void onInitializeClient() {
        MacroManager.load();
        registerSlotKeys();
        MacroCommands.register();

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            MacroManager.tick(client);
            while (OPEN_GUI_KEY.wasPressed()) {
                if (client.currentScreen instanceof MacroScreen) {
                    client.setScreen(null);
                } else {
                    client.setScreen(new MacroScreen());
                }
            }
            for (int slot = 0; slot < SLOT_KEYS.length; slot++) {
                while (SLOT_KEYS[slot].wasPressed()) {
                    MacroManager.runBound(slot + 1, client);
                }
            }
        });
    }

    private static void registerSlotKeys() {
        int[] defaults = {GLFW.GLFW_KEY_F6, GLFW.GLFW_KEY_F7, GLFW.GLFW_KEY_F8, GLFW.GLFW_KEY_F9, GLFW.GLFW_KEY_F10};
        for (int index = 0; index < SLOT_KEYS.length; index++) {
            SLOT_KEYS[index] = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.kodari_macros.slot_" + (index + 1),
                defaults[index],
                CATEGORY
            ));
        }
    }
}