Files
Lophine/lophine-server/minecraft-patches/features/0048-Add-config-for-item-multitask.patch
Helvetica Volubi 3a8f64da64 Update Folia
2026-08-12 03:49:09 +08:00

40 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Libalpm64 <Levamara@proton.me>
Date: Wed, 4 Mar 2026 00:00:00 +0000
Subject: [PATCH] Add config for item multitask
Allows players to use items while moving or switching hotbar slots. This
is for Anarchy servers or Crystal PVP servers this allows them to pvp
without stopping the item mid animation.
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 40b409ad07eaa03473712ba83bc4ccd9a5c0f932..95715be85fe2d35d219a496f6677732833d6b345 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2187,7 +2187,9 @@ public class ServerGamePacketListenerImpl
this.player.sendSpawnProtectionMessage(pos);
} else if (this.awaitingPositionFromClient == null && (level.mayInteract(this.player, pos) || passthroughSignInteraction)) {
// Paper end - Allow using signs inside spawn protection
+ if (!me.earthme.luminol.config.modules.fixes.ItemMultitaskConfig.enabled) { // Luminol - Add item multitask config
this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
+ } // Luminol - Add item multitask config
InteractionResult interactionResult = this.player.gameMode.useItemOn(this.player, level, itemStack, hand, blockHit);
if (interactionResult.consumesAction()) {
CriteriaTriggers.ANY_BLOCK_USE.trigger(this.player, blockHit.getBlockPos(), itemStack);
@@ -2386,9 +2388,13 @@ public class ServerGamePacketListenerImpl
return;
}
// CraftBukkit end
- if (this.player.getInventory().getSelectedSlot() != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
- this.player.stopUsingItem();
+ // Luminol start - Add item multitask config
+ if (!me.earthme.luminol.config.modules.fixes.ItemMultitaskConfig.enabled) {
+ if (this.player.getInventory().getSelectedSlot() != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
+ this.player.stopUsingItem();
+ }
}
+ // Luminol end
this.player.getInventory().setSelectedSlot(packet.getSlot());
this.player.resetLastActionTime();