Majbaul Haque

A Minecraft Fabric client-side mod that automatically opens Vaults in Trial Chambers and filters dropped items (Mace, Heavy Core, Trident, Enchanted Books, etc.).

Features Cursor Targeting: Detects the exact Vault block you are looking at under your crosshair (using default client block reach).

Smart Keys matching: Knows when to use a standard Trial Key or Ominous Trial Key on the respective Vault types.

Visual Display: Outputs the name of the currently spinning item in the focused Vault directly above your hotbar (action bar).

Item Filtering: Reads the internal item currently displayed by the Vault and only opens the Vault if the item matches your whitelist.

Wind Burst Verification: For Enchanted Books, can specifically check if the book has the Wind Burst enchantment before opening.

Interactive GUI: Easy configuration of target Vault types, item whitelist presets, and custom item ID support.

Controls G: Toggle the Auto Vault mod on/off.

K: Open the Configuration GUI screen.

Configuration The mod configuration is saved to .minecraft/config/autovault.json and can be adjusted through the GUI:

Open Ominous Vaults: Toggle opening ominous trial vaults.

Open Normal Vaults: Toggle opening normal trial vaults.

Item Filter: Toggle the whitelist check.

Item Presets: Quick checkmarks for Trident, Mace, Heavy Core, and Enchanted Book.

Add / Remove: Field to register any custom Minecraft item identifier (e.g. minecraft:diamond).

Kodari AI
KodariOct 15 at 4:00 am 3
AutoVaultOpener
A Minecraft Fabric client-side mod that automatically opens Trial Chamber Vaults. Detects the targeted Vault block under the crosshair, matches the correct Trial Key or Ominous Trial Key to the Vault type, and displays the spinning item name in the action bar. Includes an item whitelist filter that only opens Vaults when the displayed item matches configured criteria, with special Wind Burst enchantment verification for Enchanted Books. Features a configuration GUI for toggling Vault types, selecting item presets (Trident, Mace, Heavy Core, Enchanted Book), and adding custom item IDs. Config saved to autovault.json. Controls: G toggles the mod, K opens the configuration screen.
  1. Set up the client-only mod, keybinds, config persistence, and Vault automation.

  2. Add matching-key selection, item/Wind Burst filtering, and hotbar item feedback.

  3. Add the owo-ui configuration screen and its controls.

Built the client-only Auto Vault mod for Minecraft 26.2. It targets the Vault under your crosshair, shows its displayed reward above the hotbar, filters rewards (including optional Wind Burst verification), and selects the matching Trial Key from your hotbar before interacting.

  • G toggles Auto Vault; K opens settings. Settings are also available through ModMenu.

  • Configure normal/ominous Vaults, whitelist presets, and custom item IDs in .minecraft/config/autovault.json or the settings screen.

  • The matching key must be in your hotbar for automatic opening.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
10 452
src/client/java/com/kodari/autovault/client/AutoVaultClient.java
package com.kodari.autovault.client;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.core.component.DataComponents;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.Identifier;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.item.enchantment.ItemEnchantments;
import net.minecraft.world.level.block.VaultBlock;
import net.minecraft.world.level.block.entity.vault.VaultBlockEntity;
import net.minecraft.world.phys.BlockHitResult;
import org.lwjgl.glfw.GLFW;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class AutoVaultClient implements ClientModInitializer {

    public static final Logger LOGGER = LoggerFactory.getLogger("autovault");

    private static KeyMapping toggleKey;
    private static KeyMapping settingsKey;
    private static BlockPos focusedVault;
    private static int openCooldown;

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

        toggleKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
                "key.autovault.toggle", GLFW.GLFW_KEY_G, KeyMapping.Category.MISC));
        settingsKey = KeyMappingHelper.registerKeyMapping(new KeyMapping(
                "key.autovault.config", GLFW.GLFW_KEY_K, KeyMapping.Category.MISC));

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

    private static void onClientTick(Minecraft client) {
        if (openCooldown > 0) {
            openCooldown--;
        }

        if (toggleKey.consumeClick()) {
            AutoVaultConfig.Config config = AutoVaultConfig.get();
            config.enabled = !config.enabled;
            AutoVaultConfig.save();
            client.gui.hud.setOverlayMessage(net.minecraft.network.chat.Component.literal(
                    "Auto Vault " + (config.enabled ? "enabled" : "disabled")), false);
        }

        if (settingsKey.consumeClick()) {
            client.gui.setScreen(AutoVaultSettings.createScreen(client.gui.screen()));
        }

        if (!AutoVaultConfig.get().enabled || client.player == null || client.level == null
                || client.gameMode == null || !(client.hitResult instanceof BlockHitResult blockHit)) {
            clearFocus();
            return;
        }

        BlockPos pos = blockHit.getBlockPos();
        if (!(client.level.getBlockEntity(pos) instanceof VaultBlockEntity vault)) {
            clearFocus();
            return;
        }

        if (!pos.equals(focusedVault)) {
            focusedVault = pos;
            openCooldown = 0;
        }

        if (!vault.getSharedData().hasDisplayItem()) {
            return;
        }

        ItemStack displayItem = vault.getSharedData().getDisplayItem();
        client.gui.hud.setOverlayMessage(displayItem.getHoverName(), false);

        boolean ominous = client.level.getBlockState(pos).getValue(VaultBlock.OMINOUS);
        AutoVaultConfig.Config config = AutoVaultConfig.get();
        if ((ominous && !config.openOminousVaults) || (!ominous && !config.openNormalVaults)
                || !isWhitelisted(client.level, displayItem, config)) {
            return;
        }

        if (openCooldown > 0) {
            return;
        }

        Item requiredKey = ominous ? Items.OMINOUS_TRIAL_KEY : Items.TRIAL_KEY;
        int keySlot = findHotbarKeySlot(client.player.getInventory(), requiredKey);
        if (keySlot < 0) {
            return;
        }

        client.player.getInventory().setSelectedSlot(keySlot);
        client.gameMode.useItemOn(client.player, InteractionHand.MAIN_HAND, blockHit);
        openCooldown = 10;
    }

    private static boolean isWhitelisted(ClientLevel level, ItemStack stack, AutoVaultConfig.Config config) {
        if (!config.filterItems) {
            return true;
        }

        Item item = stack.getItem();
        if (config.includeTrident && item == Items.TRIDENT) {
            return true;
        }
        if (config.includeMace && item == Items.MACE) {
            return true;
        }
        if (config.includeHeavyCore && item == Items.HEAVY_CORE) {
            return true;
        }
        if (item == Items.ENCHANTED_BOOK && config.includeEnchantedBooks) {
            return !config.windBurstOnly || hasWindBurst(level, stack);
        }

        Identifier itemId = BuiltInRegistries.ITEM.getKey(item);
        return itemId != null && config.customItemIds.contains(itemId.toString());
    }

    private static boolean hasWindBurst(ClientLevel level, ItemStack stack) {
        Holder<Enchantment> windBurst = level.registryAccess()
                .lookupOrThrow(Registries.ENCHANTMENT)
                .getOrThrow(Enchantments.WIND_BURST);
        return stack.getOrDefault(DataComponents.STORED_ENCHANTMENTS, ItemEnchantments.EMPTY)
                .getLevel(windBurst) > 0;
    }

    private static int findHotbarKeySlot(Inventory inventory, Item requiredKey) {
        for (int slot = 0; slot < Inventory.SELECTION_SIZE; slot++) {
            if (inventory.getNonEquipmentItems().get(slot).getItem() == requiredKey) {
                return slot;
            }
        }
        return -1;
    }

    private static void clearFocus() {
        focusedVault = null;
        openCooldown = 0;
    }
}