Jugal Rajput

ye 1 minecraft ka mod rahene wala ha jo minecraft ke triel chamber me omnius vault hota uski item list show karega. aur jo bhi item ham select karege jaise mereko heavy Core chiye wo list me select karuga tho jaise hi omnius vault me heavy Core show hoga waise hi auto key place hojayegi aur wo item hame mil jayegi asa hone wala ha ye mod ye mod ki gui ko open karne ke liye G button se hoga aur ye mod 1.21.11 ke liye hoga aur ye 1 jar file honi chiye aur client side hoga ye mod aur work karna chiye sare servers mein

Kodari AI
KodariSep 18 at 9:21 am 11
OmniusVaultAutoLoot
Client-side Minecraft mod for Fabric 1.21.11 that enhances Trial Chamber gameplay. Press G to open an item selection GUI listing all possible Omnius Vault rewards. When the player selects an item (e.g., Heavy Core), the mod automatically presses the vault key the moment that item appears in the vault's reward display, instantly claiming it. Works on all servers, packaged as a single JAR file.

Plan:

  1. Create the Fabric 1.21.11 client-only mod scaffold and metadata.

  2. Add the G-key selection screen for vault loot targets.

  3. Detect nearby ominous vault previews and automate a normal ominous-key interaction when the selected item appears.

  4. Add the required mixin/configuration and assets so the result is one client JAR.

  1. Fabric 1.21.11 client mod scaffold बनाया गया: Gradle, Fabric metadata, Java 21 और client-only entrypoint।

  2. G key GUI जोड़ी गई: item ID से search करके vault reward select कर सकते हैं।

  3. Ominous Vault detection जोड़ा गया: selected item का preview nearby active ominous vault में दिखते ही mod automatically OMINOUS_TRIAL_KEY से normal interaction भेजता है।

  4. Inventory handling: hotbar या offhand में key खोजकर interaction करता है और selected slot restore करता है।

  5. यह client-side है और server को normal vanilla interaction packet भेजता है—server-side loot rules या permissions bypass नहीं करता। Mod JAR build/libs/ में बनेगा।

Jugal Rajput

build/libs/

Kodari AI
KodariSep 18 at 12:36 pm 1

build/libs/ अभी खाली है क्योंकि mod build नहीं हुआ है। Build करने के बाद JAR यहाँ बनेगी:

Plain Text
build/libs/kodari-vault-loot-1.0.0.jar

Command:

Shell
./gradlew build

अगर Windows है:

Shell
gradlew.bat build

बनी हुई JAR को build/libs/ से Minecraft के mods/ folder में रखें।

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
7 366
src/client/java/com/kodari/vaultloot/VaultLootClient.java
package com.kodari.vaultloot;

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.block.BlockState;
import net.minecraft.block.VaultBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.VaultBlockEntity;
import net.minecraft.block.enums.VaultState;
import net.minecraft.client.MinecraftClient;
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.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.glfw.GLFW;

public class VaultLootClient implements ClientModInitializer {
    private static final Identifier KEY_CATEGORY_ID = Identifier.of("kodari_vault_loot", "controls");
    private static final KeyBinding OPEN_SCREEN = KeyBindingHelper.registerKeyBinding(new KeyBinding(
        "key.kodari_vault_loot.open",
        InputUtil.Type.KEYSYM,
        GLFW.GLFW_KEY_G,
        KeyBinding.Category.create(KEY_CATEGORY_ID)
    ));

    private static Item selectedItem;
    private static int clientTicks;
    private static int lastInteractionTick = -1000;
    private static int lastVaultX;
    private static int lastVaultY;
    private static int lastVaultZ;

    @Override
    public void onInitializeClient() {
        ClientTickEvents.END_CLIENT_TICK.register(VaultLootClient::tick);
    }

    public static Item getSelectedItem() {
        return selectedItem;
    }

    public static void setSelectedItem(Item item) {
        selectedItem = item;
    }

    private static void tick(MinecraftClient client) {
        clientTicks++;

        if (OPEN_SCREEN.wasPressed()) {
            client.setScreen(new LootSelectionScreen());
        }

        tryUnlockMatchingVault(client);
    }

    private static void tryUnlockMatchingVault(MinecraftClient client) {
        if (selectedItem == null || client.world == null || client.player == null || client.interactionManager == null) {
            return;
        }

        if (clientTicks - lastInteractionTick < 10) {
            return;
        }

        ClientPlayerEntity player = client.player;
        Hand hand = findKeyHand(player);
        if (hand == null) {
            return;
        }

        BlockPos playerPos = player.getBlockPos();
        for (BlockPos pos : BlockPos.iterate(
            playerPos.getX() - 8,
            playerPos.getY() - 5,
            playerPos.getZ() - 8,
            playerPos.getX() + 8,
            playerPos.getY() + 5,
            playerPos.getZ() + 8
        )) {
            if (pos.getX() == lastVaultX && pos.getY() == lastVaultY && pos.getZ() == lastVaultZ
                && clientTicks - lastInteractionTick < 100) {
                continue;
            }

            BlockState state = client.world.getBlockState(pos);
            if (!(state.getBlock() instanceof VaultBlock)
                || !state.get(VaultBlock.OMINOUS)
                || state.get(VaultBlock.VAULT_STATE) != VaultState.ACTIVE) {
                continue;
            }

            BlockEntity blockEntity = client.world.getBlockEntity(pos);
            if (!(blockEntity instanceof VaultBlockEntity vault)) {
                continue;
            }

            ItemStack displayItem = vault.getSharedData().getDisplayItem();
            if (displayItem.isEmpty() || !displayItem.isOf(selectedItem)) {
                continue;
            }

            int previousSlot = player.getInventory().getSelectedSlot();
            if (hand == Hand.MAIN_HAND) {
                int keySlot = findHotbarKey(player);
                if (keySlot >= 0 && keySlot != previousSlot) {
                    player.getInventory().setSelectedSlot(keySlot);
                }
            }

            client.interactionManager.interactBlock(
                player,
                hand,
                new BlockHitResult(Vec3d.ofCenter(pos), Direction.UP, pos, false)
            );

            if (hand == Hand.MAIN_HAND && player.getInventory().getSelectedSlot() != previousSlot) {
                player.getInventory().setSelectedSlot(previousSlot);
            }

            lastInteractionTick = clientTicks;
            lastVaultX = pos.getX();
            lastVaultY = pos.getY();
            lastVaultZ = pos.getZ();
            return;
        }
    }

    private static Hand findKeyHand(ClientPlayerEntity player) {
        if (findHotbarKey(player) >= 0) {
            return Hand.MAIN_HAND;
        }

        if (player.getInventory().getStack(PlayerInventorySlots.OFF_HAND).isOf(Items.OMINOUS_TRIAL_KEY)) {
            return Hand.OFF_HAND;
        }

        return null;
    }

    private static int findHotbarKey(ClientPlayerEntity player) {
        for (int slot = 0; slot < PlayerInventorySlots.HOTBAR_SIZE; slot++) {
            if (player.getInventory().getStack(slot).isOf(Items.OMINOUS_TRIAL_KEY)) {
                return slot;
            }
        }

        return -1;
    }

    private static final class PlayerInventorySlots {
        private static final int HOTBAR_SIZE = 9;
        private static final int OFF_HAND = 40;
    }
}