Matis

Create a Fabric 1.21.4 client-side Minecraft mod for HugoSMP. F6 toggles Auto-Sell. F7 opens a configuration GUI. The GUI lets me add the item in my hand, add an item by Minecraft ID, remove individual items by clicking them, and clear the list. Only configured items may be sold. When Auto-Sell is enabled, automatically run /sell, detect the server's Sell GUI, put only configured items from my inventory into the sell slots, click the green confirm button, wait for the GUI to update, and repeat. Save the configured item list between game restarts. Make the mod work with Fabric API and provide a compiled JAR.

Kodari AI
KodariOct 8 at 4:44 pm 3
AutoSellConfigurator
Client-side Fabric 1.21.4 mod for HugoSMP. F6 toggles Auto-Sell, F7 opens a configuration GUI to add held items or by Minecraft ID, remove items by clicking, and clear the list. Only configured items are sold. Auto-Sell runs /sell, detects the server GUI, deposits only configured inventory items into sell slots, clicks the green confirm button, waits for GUI updates, and repeats. Item list persists across restarts via config file.
  1. Set up the Fabric 1.21.4 client-only project and metadata.

  2. Add F6 auto-sell automation, using the source-confirmed screen, slot and click APIs.

  3. Add the F7 item-list GUI and persist its contents across restarts.

Created the HugoSMP client mod with F6 Auto-Sell, an F7 settings screen for adding items by hand or Minecraft ID, removing individual entries, clearing the list, and saving the configured IDs between restarts. Auto-Sell sends /sell, moves only configured items into insertable sell slots, and looks for a green or labeled confirm button before continuing.

To build and download the JAR: click Compile in the top bar, click Compile in the window, then click Download when the build succeeds.

Matis

das geht Nicht also die items die ich sellen will kommen nicht in denn sell menü rein

Kodari AI
KodariOct 8 at 4:50 pm 1

The generation was stopped before any content could be produced.

Matis

Ich will das du so machst wie es geschriben wurde aber das die items direkt in /sell rein gemacht werden und automatisch rein und auf escape drückt oder so was und das menü viel schöner ist

Kodari AI
KodariOct 8 at 5:10 pm 3
  1. Исправить автоматическую отправку настроенных предметов в меню /sell и закрытие GUI после продажи.

  2. Обновить экран F7, чтобы список и управление им выглядели аккуратнее.

Auto-Sell probiert jetzt zuerst Shift-Klick, prüft, ob der konfigurierte Stapel wirklich verschoben wurde, und nutzt bei Bedarf einen Klick in einen leeren Menü-Slot. Abgewiesene Klicks werden zurückgesetzt, damit kein Item am Cursor hängen bleibt. Nach dem grünen Bestätigen wartet der Mod auf eine Menüänderung, schließt das Menü mit dem echten Server-Schließaufruf und startet /sell erneut.

Das F7-Menü hat jetzt ein dunkles Layout mit Statusanzeige, deutlicher Itemliste, „REMOVE“-Zeilen und überarbeiteten Eingabe- und Seitenbuttons. Die Itemliste bleibt weiterhin gespeichert.

Das JAR erhältst du über Compile oben → Compile im Fenster → Download nach erfolgreichem Build. Falls HugoSMP das Menü trotzdem nicht erkennt, brauche ich den Fenstertitel oder einen Screenshot des /sell-Menüs.

Matis
📎 1 file 2,470 chars
📄
pasted-code-1791479673679.txt
txt 65 lines
▶
Create a Minecraft Fabric 1.21.4 client-side Sell Macro mod for HugoSMP.

The mod must have a beautiful, modern and easy-to-use configuration menu.

FEATURES:

1. SELL LIST
- Add a customizable list of items that I want to sell.
- I can add an item by holding it in my hand and clicking "Add item in hand".
- Also allow adding items by entering their Minecraft item ID.
- Show all selected items in the list with their item icons and names.
- I can remove individual items from the list.
- Add a "Clear list" button.
- Save the sell list permanently so it remains after restarting Minecraft.

2. AUTO SELL
- Add an Auto-Sell ON/OFF toggle.
- Default keybind: F6.
- When Auto-Sell is enabled, automatically execute the Minecraft command:
  /sell
- Wait for the HugoSMP Sell GUI to open.
- Detect the Sell GUI automatically.
- Only take items from my inventory that are included in my configured sell list.
- Put those items into the correct sell slots in the Sell GUI automatically.
- Do not sell items that are NOT on my sell list.
- Automatically click the green confirmation/sell button.
- Wait until the transaction is completed.
- Repeat the process automatically while Auto-Sell is enabled.
- Add a configurable delay between actions to prevent clicking too quickly.

3. GUI
Create a very polished, modern Minecraft GUI.
It should have:
- A large "Auto Sell" ON/OFF toggle.
- A "Sell List" section.
- Item icons and item names.
- "Add item in hand" button.
- "Add item by ID" button.
- "Remove item" button.
- "Clear list" button.
- A delay/speed setting.
- A status indicator showing:
  Auto-Sell: ON/OFF
- A clean dark Minecraft-style design with smooth animations and rounded panels if possible.

4. KEYBINDS
- F6 = Toggle Auto-Sell.
- F7 = Open the Sell Macro configuration menu.
- Make the keybinds configurable through Minecraft's Controls menu.

5. SAFETY
- Never sell items that are not on the configured sell list.
- Never move items from armor slots, offhand, or other protected slots.
- Only interact with the HugoSMP Sell GUI.
- Do not spam commands or GUI clicks.
- Stop automatically if the Sell GUI closes unexpectedly.

6. TECHNICAL
- Minecraft version: 1.21.4
- Mod loader: Fabric
- Client-side mod.
- Use Fabric API.
- Generate a working compiled .jar file that can be placed directly into the Minecraft mods folder.
- Make sure the mod actually compiles and runs on Fabric 1.21.4.
- Do not give me only source code. I need the compiled .jar file.
Kodari AI
KodariOct 8 at 5:33 pm 4
  1. Prüfe die aktuelle Sell-Automation und finde, warum HugoSMP-Slots nicht zuverlässig erkannt oder befüllt werden.

  2. Gleiche die nötigen Fabric-/Minecraft-Aufrufe mit der 1.21.4-Quelle ab.

  3. Korrigiere die Automation gezielt und lasse das Projekt über Kodaris Build prüfen.

Der Fehler saß im manuellen Transfer-Fallback: Er blieb fälschlich als Shift-Klick markiert. Dadurch galt ein Item schon als übertragen, sobald es den Ursprungs-Slot verließ – auch wenn es nur am Cursor hing und nie im Sell-Menü landete.

Ich habe den Fallback korrigiert: Er prüft jetzt, ob die Item-Anzahl in den Menü-Slots tatsächlich gestiegen ist, versucht nur leere Slots, die Items annehmen, und gibt abgewiesene Items zurück. Außerdem zeigt das F7-Menü jetzt Item-Icons und -Namen, einen Auto-Sell-Schalter sowie eine speicherbare Verzögerung zwischen Aktionen. Schließt sich das Sell-Menü unerwartet, stoppt die Automation.

Ein fertiges JAR kann ich hier nicht direkt anhängen. Erstelle und lade es im Projekt über Compile oben → Compile im Fenster → nach erfolgreichem Build Download.

Matis

IMPORTANT: The mod must perform the COMPLETE selling process automatically.

When Auto-Sell is enabled:

  1. Automatically type and execute /sell.
  2. Wait until the HugoSMP Sell GUI is fully opened.
  3. Read the player's inventory.
  4. Find ONLY the items that are selected in the Sell List.
  5. Automatically move those selected items into the appropriate selling slots in the HugoSMP Sell GUI.
  6. Do NOT move or sell any item that is not selected.
  7. Automatically click the green SELL/CONFIRM button.
  8. Wait for the transaction to finish and the GUI to update/close.
  9. Automatically repeat the entire process.
  10. The player should not have to manually click anything after enabling Auto-Sell.

The goal is a FULLY AUTOMATIC GUI SELL MACRO, not simply a macro that repeatedly types /sell.

Kodari AI
KodariOct 8 at 5:50 pm 3

Auto-Sell now runs /sell once and waits for the Sell menu instead of repeatedly sending the command while it loads. It moves only configured items from the player’s regular inventory slots, clicks confirmation after a transfer, closes the menu and repeats after the cycle delay. If the menu closes unexpectedly or no Sell menu opens, Auto-Sell stops; when there’s nothing to sell, it closes the menu and retries.

Build and download the JAR:

  1. Click Compile in the top bar.

  2. Click Compile in the window.

  3. When it succeeds, click Download on the build.

The menu detector expects a title containing “sell” and a recognizable Sell/Confirm button. If HugoSMP’s menu uses different wording or buttons, send a screenshot so the detector can be matched to it.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 741
src/main/java/com/hugosmp/autosell/HugoSmpAutoSellClient.java
package com.hugosmp.autosell;

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.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

public class HugoSmpAutoSellClient implements ClientModInitializer {
    private static final Set<String> CONFIGURED_ITEM_IDS = new LinkedHashSet<>();
    private static final Set<Integer> REJECTED_SOURCE_SLOTS = new LinkedHashSet<>();
    private static final Set<Integer> REJECTED_TARGET_SLOTS = new LinkedHashSet<>();
    private static final KeyBinding TOGGLE_KEY = KeyBindingHelper.registerKeyBinding(new KeyBinding(
            "key.hugosmp_autosell.toggle", InputUtil.Type.KEYSYM, 295, "key.category.hugosmp_autosell"));
    private static final KeyBinding CONFIG_KEY = KeyBindingHelper.registerKeyBinding(new KeyBinding(
            "key.hugosmp_autosell.config", InputUtil.Type.KEYSYM, 296, "key.category.hugosmp_autosell"));

    private static boolean autoSellEnabled;
    private static Path configPath;
    private static Path delayPath;
    private static int actionDelayTicks = 4;
    private static long tickCount;
    private static long nextCommandTick;
    private static Screen activeSellScreen;
    private static int actionDelay;
    private static boolean movedItemsInSession;
    private static boolean confirmSent;
    private static int confirmWait;
    private static String confirmSnapshot;
    private static long lastSellProgressTick;
    private static boolean repeatAfterSellScreen;
    private static boolean awaitingSellScreen;
    private static long sellCommandTick;
    private static int pendingSourceSlotId = -1;
    private static int pendingSourceCount;
    private static String pendingSourceItemId;
    private static boolean pendingQuickMove;
    private static int pendingTargetSlotId = -1;
    private static int pendingSellItemCount;

    @Override
    public void onInitializeClient() {
        configPath = MinecraftClient.getInstance().runDirectory.toPath()
                .resolve("config").resolve("hugosmp-autosell.txt");
        delayPath = configPath.resolveSibling("hugosmp-autosell-delay.txt");
        loadConfiguredItems();
        loadActionDelay();
        ClientTickEvents.END_CLIENT_TICK.register(HugoSmpAutoSellClient::clientTick);
    }

    private static void clientTick(MinecraftClient client) {
        tickCount++;

        while (TOGGLE_KEY.wasPressed()) {
            autoSellEnabled = !autoSellEnabled;
            if (autoSellEnabled) {
                nextCommandTick = 0;
            }
        }
        while (CONFIG_KEY.wasPressed()) {
            client.setScreen(new ItemListScreen(0));
        }

        if (!autoSellEnabled || client.player == null || client.interactionManager == null) {
            resetSellSession();
            awaitingSellScreen = false;
            return;
        }

        if (client.currentScreen instanceof HandledScreen<?> handledScreen && isSellScreen(handledScreen)) {
            if (activeSellScreen != handledScreen) {
                resetSellSession();
                activeSellScreen = handledScreen;
                lastSellProgressTick = tickCount;
            }
            awaitingSellScreen = false;
            processSellScreen(client, handledScreen);
            return;
        }

        if (activeSellScreen != null) {
            boolean shouldRepeat = repeatAfterSellScreen;
            if (shouldRepeat && client.currentScreen instanceof HandledScreen<?>) {
                client.player.closeHandledScreen();
            }
            resetSellSession();
            awaitingSellScreen = false;
            if (shouldRepeat) {
                nextCommandTick = tickCount + sellCycleDelayTicks();
            } else {
                autoSellEnabled = false;
            }
            return;
        }

        if (awaitingSellScreen) {
            if (client.currentScreen instanceof HandledScreen<?>) {
                autoSellEnabled = false;
                awaitingSellScreen = false;
                return;
            }
            if (tickCount - sellCommandTick > 100) {
                autoSellEnabled = false;
                awaitingSellScreen = false;
            }
            return;
        }

        if (client.currentScreen == null && !CONFIGURED_ITEM_IDS.isEmpty() && tickCount >= nextCommandTick) {
            client.player.networkHandler.sendChatCommand("sell");
            awaitingSellScreen = true;
            sellCommandTick = tickCount;
            nextCommandTick = tickCount + sellCycleDelayTicks();
        }
    }

    private static boolean isSellScreen(HandledScreen<?> screen) {
        return screen.getTitle().getString().toLowerCase(Locale.ROOT).contains("sell");
    }

    private static void processSellScreen(MinecraftClient client, HandledScreen<?> screen) {
        ScreenHandler handler = screen.getScreenHandler();
        ClientPlayerEntity player = client.player;

        if (confirmSent) {
            if (!confirmSnapshot.equals(snapshot(handler))) {
                repeatAfterSellScreen = true;
                player.closeHandledScreen();
                return;
            }
            if (confirmWait-- <= 0) {
                repeatAfterSellScreen = true;
                player.closeHandledScreen();
                return;
            }
            return;
        }

        if (pendingSourceSlotId >= 0) {
            if (actionDelay > 0) {
                actionDelay--;
                return;
            }

            int sourceId = pendingSourceSlotId;
            int previousCount = pendingSourceCount;
            String previousItemId = pendingSourceItemId;
            boolean wasQuickMove = pendingQuickMove;
            int targetSlotId = pendingTargetSlotId;
            int previousSellItemCount = pendingSellItemCount;
            Slot source = handler.slots.get(sourceId);
            ItemStack currentStack = source.getStack();
            boolean sourceChanged = currentStack.isEmpty()
                    || !Registries.ITEM.getId(currentStack.getItem()).toString().equals(previousItemId)
                    || currentStack.getCount() < previousCount;
            boolean addedToSellSlots = countSellItem(handler, player, previousItemId) > previousSellItemCount;
            pendingSourceSlotId = -1;
            pendingSourceItemId = null;
            pendingQuickMove = false;
            pendingTargetSlotId = -1;

            if (!wasQuickMove && !handler.getCursorStack().isEmpty()) {
                client.interactionManager.clickSlot(handler.syncId, sourceId, 0,
                        SlotActionType.PICKUP, player);
                if (addedToSellSlots) {
                    movedItemsInSession = true;
                    lastSellProgressTick = tickCount;
                    REJECTED_TARGET_SLOTS.clear();
                } else if (targetSlotId >= 0) {
                    REJECTED_TARGET_SLOTS.add(targetSlotId);
                }
                actionDelay = actionDelayTicks;
                return;
            }

            if (addedToSellSlots) {