I

When you press G, the mod activates Lunge Swap mode. While active, pressing your Left Mouse Button automatically switches your selected hotbar slot to the slot containing your Lunge-enchanted spear. You remain on the spear after switching.

Pressing G again disables the feature, restoring your Left Mouse Button to its normal Minecraft function.

  • G ON: Left-click activates Lunge spear swapping.
  • G OFF: Left-click works normally.
  • Toggle anytime: Switch between both modes whenever you want.
Kodari AI
KodariNov 3 at 2:36 pm 2
LungeSwapMod
A Fabric mod that adds a toggleable Lunge Swap mode. Pressing G activates the mode, causing left-click attacks to automatically switch the selected hotbar slot to the one containing a Lunge-enchanted spear. Pressing G again disables the feature, restoring normal left-click behavior. The mod listens for keybind toggles and intercepts attack inputs to perform the hotbar swap seamlessly.
  1. Set up the Fabric 26.3 project and keybinding.

  2. Toggle Lunge Swap with G; when enabled, left-click switches to a hotbar spear enchanted with Lunge, without attacking on the switching click.

Added the Lunge Swap Fabric 26.3 mod. Press G to toggle it; with the mode enabled, left-click switches to a hotbar item enchanted with Lunge and cancels that click. Once you’re holding it, left-click works normally. Press G again to disable swapping.

It uses an existing Lunge-enchanted spear; no new items are added.

I

it does not work?

Kodari AI
KodariNov 3 at 2:45 pm 1

Fixed the left-click handling. The mixin was returning false after switching slots, which still let Minecraft process the held attack input that tick. It now returns true when a Lunge spear is selected, so that click is consumed by the swap.

I

i can't find the toggle key in keybinds

Kodari AI
KodariNov 3 at 2:47 pm 1

Moved the keybinding registration into client initialization and added a dedicated Lunge Swap category. Find Toggle Lunge Swap under Options → Controls → Key Binds → Lunge Swap; its default key is G.

I

which version?

Kodari AI
KodariNov 3 at 2:48 pm 1

It’s a Fabric mod for Minecraft 26.3.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 179
src/client/java/com/kodari/lungeswap/client/LungeSwapClient.java
package com.kodari.lungeswap.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 net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;

public final class LungeSwapClient implements ClientModInitializer {
	private static KeyMapping TOGGLE_KEY;
	private static boolean enabled;

	@Override
	public void onInitializeClient() {
		TOGGLE_KEY = KeyMappingHelper.registerKeyMapping(
			new KeyMapping(
				"key.lungeswap.toggle",
				InputConstants.Type.KEYBOARD,
				InputConstants.KEY_G,
				KeyMapping.Category.register(Identifier.fromNamespaceAndPath("lungeswap", "lunge_swap"))
			)
		);
		ClientTickEvents.END_CLIENT_TICK.register(client -> {
			if (TOGGLE_KEY.consumeClick()) {
				enabled = !enabled;
			}
		});
	}

	public static boolean selectLungeSpear(Minecraft client) {
		if (!enabled || client.player == null) {
			return false;
		}

		Player player = client.player;
		Inventory inventory = player.getInventory();
		int selectedSlot = inventory.getSelectedSlot();
		var hotbar = inventory.getNonEquipmentItems();
		var lunge = player.level().registryAccess()
			.lookupOrThrow(Registries.ENCHANTMENT)
			.getOrThrow(Enchantments.LUNGE);

		if (EnchantmentHelper.getItemEnchantmentLevel(lunge, hotbar.get(selectedSlot)) > 0) {
			return false;
		}

		for (int slot = 0; slot < 9; slot++) {
			if (slot != selectedSlot && EnchantmentHelper.getItemEnchantmentLevel(lunge, hotbar.get(slot)) > 0) {
				inventory.setSelectedSlot(slot);
				return true;
			}
		}

		return false;
	}
}