67mango67
📎 1 file 2,074 chars
📄
pasted-code-1794238992402.txt
txt 64 lines
▶
# AH Item Selector

Create a client-side Fabric mod for Minecraft 1.21.11 using Java 21.

## Main functionality
- Open the item selection menu by pressing H.
- Display a catalog of Minecraft items.
- Include vanilla items and custom server items from plugins.
- Display item icons, names and descriptions.
- All item names and interface text must be in Russian.
- Use Russian localized item names whenever available.
- Preserve original item names for custom server items when their Russian translation is unavailable.

## Item collection
- Collect vanilla Minecraft items from the item registry.
- Support custom item names and CustomModelData.
- Support server resource packs and custom textures.
- Scan items encountered in player inventory, containers and server menus.
- Save discovered custom items locally.
- Avoid duplicate entries.
- Store item information, including display names and item data when available.

## Search and categories
- Add a Russian search bar.
- Add categories:
  - Блоки
  - Оружие
  - Инструменты
  - Броня
  - Еда
  - Зелья
  - Ресурсы
  - Разное
  - Серверные предметы
- Add a favorites section.
- Add recently selected items.

## Auction House integration
When the player clicks an item:
1. Close the selection menu.
2. Send the command:
   /ah search 
3. Use the correct Russian display name for custom server items.
4. Do not open chat.
5. Do not send additional messages.

## Interface
- Modern dark interface.
- Item icons displayed in a grid.
- Search bar at the top.
- Category navigation on the left.
- Smooth scrolling.
- Mouse interaction.
- ESC closes the menu.

## Technical requirements
- Minecraft 1.21.11.
- Fabric Loader.
- Java 21.
- Client-side only.
- No server-side installation.
- Lightweight and compatible with other Fabric mods.

Important: Do not claim that every server plugin item can be discovered automatically. Discover items from available client-side data and save encountered custom items locally. Keep the project fully compilable.
Kodari AI
KodariNov 9 at 3:55 pm 4
AHItemSelector
Client-side Fabric mod for Minecraft 1.21.11 that opens an item selection catalog by pressing H. Displays vanilla and custom server items with Russian localized names, icons, and descriptions in a modern dark interface. Features Russian search bar, categories (blocks, weapons, tools, armor, food, potions, resources, miscellaneous, server items), favorites, and recently selected sections. Discovers custom items from inventory, containers, and server menus, saving them locally without duplicates. Clicking an item closes the menu and executes /ah search with the correct Russian display name without opening chat. Supports CustomModelData, server resource packs, and custom textures. Lightweight, client-side only, Java 21.
  1. Add the Fabric 1.21.11 client project setup and bundle owo-lib for the required screen framework.

  2. Implement Russian item naming, vanilla catalog, client-observed custom-item discovery, and local persistence for discovered data, favorites, and recent selections.

  3. Build the searchable category browser and H-key auction search flow with an owo-ui dark grid interface.

Created the Fabric 1.21.11 client mod with an owo-ui catalog opened by H, Russian search and categories, favorites, recent selections, and a dark item grid. Selecting an item closes the menu and sends /ah search <item name> directly without opening chat.

The catalog uses Russian translations where available and records custom items encountered in inventories and open containers. Discovered names and CustomModelData, favorites, and recent selections are saved locally in config/ah_item_selector.properties. Discovery depends on client-visible item data; it cannot automatically find every server-plugin item.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
9 826
src/client/java/ru/kodari/ahitemselector/AhItemSelectorClient.java
package ru.kodari.ahitemselector;

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.ingame.HandledScreen;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;

public final class AhItemSelectorClient implements ClientModInitializer {
    private static final ItemCatalog CATALOG = new ItemCatalog();
    private static KeyBinding openCatalogKey;
    private int scanTicks;

    @Override
    public void onInitializeClient() {
        CATALOG.load(MinecraftClient.getInstance());

        KeyBinding.Category category = KeyBinding.Category.create(Identifier.of("ahitemselector", "main"));
        openCatalogKey = KeyBindingHelper.registerKeyBinding(
                new KeyBinding("key.ahitemselector.open", GLFW.GLFW_KEY_H, category)
        );

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            if (openCatalogKey.wasPressed() && client.player != null) {
                client.setScreen(new SelectorScreen(CATALOG));
            }

            if (client.player == null || ++this.scanTicks < 10) {
                return;
            }

            this.scanTicks = 0;
            CATALOG.scan(client.player.getInventory());

            if (client.currentScreen instanceof HandledScreen<?> handledScreen) {
                for (Slot slot : handledScreen.getScreenHandler().slots) {
                    ItemStack stack = slot.getStack();
                    CATALOG.discover(stack);
                }
            }
        });
    }
}