Files
Shiroha/shiroha-server/minecraft-patches/features/0052-Add-config-for-item-multitask.patch
T
NanaChiyo0721 d52bcc8c1d
Shiroha CI / build (push) Canceled after 0s
Shiroha CI / Event File (push) Canceled after 0s
Reduce conflict blocking for unnecessary situations
2026-08-23 00:07:52 +08:00

40 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Libalpm64 <levamara@proton.me>
Date: Thu, 9 Jul 2026 10:08:30 +0800
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 0bcc7c157b32cdef930c195def8f6be77fddec0a..4f2ea3d0a3e15dd78bd4cece163d37bf773958bd 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2183,7 +2183,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 (!io.nanachiyo0721.shiroha.config.modules.fixes.ItemMultitaskConfig.enabled) { // Shiroha - Add config for item multitask
this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
+ } // Shiroha - Add config for item multitask
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);
@@ -2382,9 +2384,13 @@ public class ServerGamePacketListenerImpl
return;
}
// CraftBukkit end
- if (this.player.getInventory().getSelectedSlot() != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
- this.player.stopUsingItem();
+ // Shiroha start - Add item multitask config
+ if (!io.nanachiyo0721.shiroha.config.modules.fixes.ItemMultitaskConfig.enabled) {
+ if (this.player.getInventory().getSelectedSlot() != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
+ this.player.stopUsingItem();
+ }
}
+ // Shiroha end
this.player.getInventory().setSelectedSlot(packet.getSlot());
this.player.resetLastActionTime();