whoknowsflare

create a minecraft mod that help's drop every item from inventory or chest, etc at once and also user can lock the slot's they don't want to drop

Kodari AI
KodariOct 4 at 7:30 am 2
QuickDropLocker
A Minecraft Fabric mod that enables instant dropping of all items from inventories, chests, and containers with a single keybind. Players can lock specific inventory slots to prevent them from being dropped during bulk operations. The mod provides a visual lock indicator on locked slots, a configurable keybind for the drop-all action, and per-slot toggle functionality via shift-click or a dedicated key. Supports both player inventory and any open container interface, with server-side synchronization to ensure consistent behavior across multiplayer sessions.
  1. Add a client-side bulk-drop key for inventory contents and another for the open container.

  2. Add a lock-toggle key for the hovered player-inventory slot, and skip locked slots when dropping.

  3. Create the Fabric 26.2 metadata and Java sources.

Created Bulk Drop for Fabric 26.2. Press J to drop unlocked player-inventory slots, K to drop items from an open container, or L while hovering a player-inventory slot to lock or unlock it. The default keys are configurable in Controls. Locks last for the current game session.

whoknowsflare

also make sure user can tranfer item in 1 click from his inventory to chest, barrel, echest etc and also vise versa while sticking to the lock slot system

Kodari AI
KodariOct 4 at 7:35 am 1
  1. Trace the existing slot-lock and container key handling.

  2. Add a one-click transfer action both ways, skipping locked player slots.

  3. Verify the 26.2 screen/slot APIs before editing.

Added two configurable transfer keys for open containers:

  • U transfers all unlocked items from your inventory into the container.

  • I transfers container items into unlocked inventory slots.

Locked slots are skipped as both transfer sources and destinations. The transfer also leaves your cursor untouched if it’s already holding an item.

whoknowsflare

also in server with /sell commands make sure user can transfer the item from his inv to /sell and etc at ease

Kodari AI
KodariOct 4 at 7:40 am 1

The U key already transfers unlocked items into any open screen that accepts inventory items, including a server’s sell GUI; I transfers them back, skipping locked slots.

A /sell command itself is server-specific: it might open a GUI, sell the held item, or sell the whole inventory. I can’t safely automate it without knowing your server’s exact command and behavior—especially because a direct sell command could ignore this client-side mod’s slot locks. What does /sell do on your server, and what command or syntax does it use?

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 280
src/client/java/com/kodari/bulkdrop/client/BulkDropClient.java
package com.kodari.bulkdrop.client;

import com.mojang.blaze3d.platform.InputConstants;
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 com.kodari.bulkdrop.mixin.AbstractContainerScreenAccessor;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.ContainerInput;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import org.lwjgl.glfw.GLFW;

import java.util.HashSet;
import java.util.Set;

public class BulkDropClient implements ClientModInitializer {
	private static final Set<Integer> LOCKED_INVENTORY_SLOTS = new HashSet<>();
	private static final KeyMapping DROP_INVENTORY = KeyMappingHelper.registerKeyMapping(new KeyMapping(
			"key.bulkdrop.drop_inventory", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_J, KeyMapping.Category.MISC));
	private static final KeyMapping DROP_CONTAINER = KeyMappingHelper.registerKeyMapping(new KeyMapping(
			"key.bulkdrop.drop_container", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_K, KeyMapping.Category.MISC));
	private static final KeyMapping TOGGLE_LOCK = KeyMappingHelper.registerKeyMapping(new KeyMapping(
			"key.bulkdrop.toggle_lock", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_L, KeyMapping.Category.MISC));
	private static final KeyMapping TRANSFER_TO_CONTAINER = KeyMappingHelper.registerKeyMapping(new KeyMapping(
			"key.bulkdrop.transfer_to_container", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_U, KeyMapping.Category.MISC));
	private static final KeyMapping TRANSFER_TO_INVENTORY = KeyMappingHelper.registerKeyMapping(new KeyMapping(
			"key.bulkdrop.transfer_to_inventory", InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_I, KeyMapping.Category.MISC));

	@Override
	public void onInitializeClient() {
		ClientTickEvents.END_CLIENT_TICK.register(BulkDropClient::onClientTick);
	}

	private static void onClientTick(Minecraft client) {
		while (TOGGLE_LOCK.consumeClick()) {
			toggleHoveredSlotLock(client);
		}
		while (DROP_INVENTORY.consumeClick()) {
			dropPlayerInventory(client);
		}
		while (DROP_CONTAINER.consumeClick()) {
			dropOpenContainer(client);
		}
		while (TRANSFER_TO_CONTAINER.consumeClick()) {
			transferToContainer(client);
		}
		while (TRANSFER_TO_INVENTORY.consumeClick()) {
			transferToInventory(client);
		}
	}

	private static void toggleHoveredSlotLock(Minecraft client) {
		if (client.player == null || !(client.gui.screen() instanceof AbstractContainerScreen<?> screen)) {
			return;
		}

		Slot slot = ((AbstractContainerScreenAccessor) screen).bulkdrop$getHoveredSlot();
		Inventory inventory = client.player.getInventory();
		if (slot == null || slot.container != inventory) {
			client.gui.hud.setOverlayMessage(Component.literal("Hover over one of your inventory slots to lock it."), false);
			return;
		}

		int inventorySlot = slot.getContainerSlot();
		if (LOCKED_INVENTORY_SLOTS.add(inventorySlot)) {
			client.gui.hud.setOverlayMessage(Component.literal("Locked inventory slot " + (inventorySlot + 1)), false);
		} else {
			LOCKED_INVENTORY_SLOTS.remove(inventorySlot);
			client.gui.hud.setOverlayMessage(Component.literal("Unlocked inventory slot " + (inventorySlot + 1)), false);
		}
	}

	private static void dropPlayerInventory(Minecraft client) {
		if (client.player == null || client.gameMode == null) {
			return;
		}

		AbstractContainerMenu menu = client.player.containerMenu;
		Inventory inventory = client.player.getInventory();
		for (int menuSlot = 0; menuSlot < menu.slots.size(); menuSlot++) {
			Slot slot = menu.slots.get(menuSlot);
			if (slot.container == inventory && !LOCKED_INVENTORY_SLOTS.contains(slot.getContainerSlot())) {
				client.gameMode.handleContainerInput(menu.containerId, menuSlot, 1, ContainerInput.THROW, client.player);
			}
		}
	}

	private static void dropOpenContainer(Minecraft client) {
		if (client.player == null || client.gameMode == null
				|| !(client.gui.screen() instanceof AbstractContainerScreen<?>)) {
			return;
		}

		AbstractContainerMenu menu = client.player.containerMenu;
		if (menu == client.player.inventoryMenu) {
			return;
		}

		Inventory inventory = client.player.getInventory();
		for (int menuSlot = 0; menuSlot < menu.slots.size(); menuSlot++) {
			Slot slot = menu.slots.get(menuSlot);
			if (slot.container != inventory) {
				client.gameMode.handleContainerInput(menu.containerId, menuSlot, 1, ContainerInput.THROW, client.player);
			}
		}
	}

	private static void transferToContainer(Minecraft client) {
		if (client.player == null || client.gameMode == null
				|| !(client.gui.screen() instanceof AbstractContainerScreen<?>)) {
			return;
		}

		AbstractContainerMenu menu = client.player.containerMenu;
		if (menu == client.player.inventoryMenu || !menu.getCarried().isEmpty()) {
			return;
		}

		Inventory inventory = client.player.getInventory();
		for (int menuSlot = 0; menuSlot < menu.slots.size(); menuSlot++) {
			Slot slot = menu.slots.get(menuSlot);
			if (slot.container == inventory && !LOCKED_INVENTORY_SLOTS.contains(slot.getContainerSlot())) {
				client.gameMode.handleContainerInput(menu.containerId, menuSlot, 0, ContainerInput.QUICK_MOVE, client.player);
			}
		}
	}

	private static void transferToInventory(Minecraft client) {
		if (client.player == null || client.gameMode == null
				|| !(client.gui.screen() instanceof AbstractContainerScreen<?>)) {
			return;
		}

		AbstractContainerMenu menu = client.player.containerMenu;
		Inventory inventory = client.player.getInventory();
		if (menu == client.player.inventoryMenu || !menu.getCarried().isEmpty()) {
			return;
		}

		for (int sourceIndex = 0; sourceIndex < menu.slots.size(); sourceIndex++) {
			Slot source = menu.slots.get(sourceIndex);
			if (source.container == inventory || source.getItem().isEmpty()) {
				continue;
			}

			client.gameMode.handleContainerInput(menu.containerId, sourceIndex, 0, ContainerInput.PICKUP, client.player);
			for (int destinationIndex = 0; destinationIndex < menu.slots.size() && !menu.getCarried().isEmpty(); destinationIndex++) {
				Slot destination = menu.slots.get(destinationIndex);
				if (destination.container != inventory
						|| LOCKED_INVENTORY_SLOTS.contains(destination.getContainerSlot())
						|| !destination.mayPlace(menu.getCarried())) {
					continue;
				}

				ItemStack existing = destination.getItem();
				ItemStack carried = menu.getCarried();
				if (!existing.isEmpty() && !ItemStack.isSameItemSameComponents(existing, carried)) {
					continue;
				}

				client.gameMode.handleContainerInput(menu.containerId, destinationIndex, 0, ContainerInput.PICKUP, client.player);
			}

			if (!menu.getCarried().isEmpty()) {
				client.gameMode.handleContainerInput(menu.containerId, sourceIndex, 0, ContainerInput.PICKUP, client.player);
			}
		}
	}
}