mrorbin

The mod lets you click, hold, and swipe your mouse across the Crafter grid to instantly lock or unlock multiple slots.

What it does:

• Instead of clicking each box one by one, you just drag your cursor over them like a paintbrush. • Every slot your mouse touches will flip its state (empty slots lock, locked slots unlock). • It never glitches or blinks because it only flips each box exactly once per swipe.

Kodari AI
KodariOct 10 at 3:11 pm 1
DragLockCrafter
DragLockCrafter enhances the Minecraft Crafter block by enabling intuitive mouse-drag interactions to lock or unlock multiple crafting slots at once. Players can click, hold, and swipe their cursor across the Crafter grid, toggling each touched slot's state in a single fluid motion. The mod tracks mouse movement and applies state changes only when the cursor enters a new slot, preventing flickering and ensuring each slot flips exactly once per swipe. This streamlines the process of configuring complex crafting recipes, making the Crafter far more efficient and user-friendly for both casual and advanced players.
  1. Set up the Fabric 26.2 project and client mixin.

  2. Add drag-paint behavior to the Crafter grid, toggling each touched slot at most once per held swipe.

Created Crafter Brush for Fabric 26.2. Left-click and drag across the Crafter grid to toggle slots; each slot is processed only once per swipe, and normal container interactions remain enabled.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 142
src/client/java/com/kodari/crafterbrush/mixin/CrafterGridDragMixin.java
package com.kodari.crafterbrush.mixin;

import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.CrafterScreen;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.world.inventory.ContainerInput;
import net.minecraft.world.inventory.CrafterSlot;
import net.minecraft.world.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(AbstractContainerScreen.class)
public abstract class CrafterGridDragMixin {
	@Unique
	private int crafterbrush$visitedSlots;

	@Shadow
	private Slot getHoveredSlot(final double x, final double y) {
		throw new AssertionError();
	}

	@Shadow
	protected abstract void slotClicked(final Slot slot, int slotId, final int buttonNum, final ContainerInput containerInput);

	@Inject(method = "mouseClicked", at = @At("HEAD"))
	private void crafterbrush$beginSwipe(final MouseButtonEvent event, final boolean doubleClick, final CallbackInfoReturnable<Boolean> cir) {
		this.crafterbrush$visitedSlots = 0;
	}

	@Inject(method = "mouseDragged", at = @At("HEAD"))
	private void crafterbrush$paintSlots(final MouseButtonEvent event, final double dx, final double dy, final CallbackInfoReturnable<Boolean> cir) {
		if (!CrafterScreen.class.isInstance(this) || event.button() != 0) {
			return;
		}

		Slot slot = this.getHoveredSlot(event.x(), event.y());
		if (!(slot instanceof CrafterSlot) || slot.index < 0 || slot.index >= 9) {
			return;
		}

		int slotMask = 1 << slot.index;
		if ((this.crafterbrush$visitedSlots & slotMask) == 0) {
			this.crafterbrush$visitedSlots |= slotMask;
			this.slotClicked(slot, slot.index, 0, ContainerInput.PICKUP);
		}
	}

	@Inject(method = "mouseReleased", at = @At("HEAD"))
	private void crafterbrush$endSwipe(final MouseButtonEvent event, final CallbackInfoReturnable<Boolean> cir) {
		this.crafterbrush$visitedSlots = 0;
	}

	@Inject(method = "slotClicked", at = @At("HEAD"))
	private void crafterbrush$rememberInitialClick(final Slot slot, int slotId, final int buttonNum, final ContainerInput containerInput, final CallbackInfo ci) {
		if (CrafterScreen.class.isInstance(this) && slot instanceof CrafterSlot && slot.index >= 0 && slot.index < 9 && containerInput == ContainerInput.PICKUP) {
			this.crafterbrush$visitedSlots |= 1 << slot.index;
		}
	}
}