Files
Shiroha/shiroha-server/minecraft-patches/features/0041-Add-config-for-item-multitask.patch
T

40 lines
2.6 KiB
Diff
Raw Normal View History

2026-07-09 00:03:09 +08:00
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
2026-07-18 19:48:30 +08:00
index 6c2d75f312f970ab9d35f6e6b8a1fa3805ebc37c..392c4b39a9c31be4b5b1fa61f6836920b43e58a3 100644
2026-07-09 00:03:09 +08:00
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
2026-07-18 19:48:30 +08:00
@@ -2182,7 +2182,9 @@ public class ServerGamePacketListenerImpl
2026-07-09 00:03:09 +08:00
this.player.sendSpawnProtectionMessage(pos);
} else if (this.awaitingPositionFromClient == null && (level.mayInteract(this.player, pos) || passthroughSignInteraction)) {
// Paper end - Allow using signs inside spawn protection
2026-07-14 12:22:17 +08:00
+ if (!io.nanachiyo0721.shiroha.config.modules.fixes.ItemMultitaskConfig.enabled) { // Shiroha - Add config for item multitask
2026-07-09 00:03:09 +08:00
this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
2026-07-14 11:32:51 +08:00
+ } // Shiroha - Add config for item multitask
2026-07-09 00:03:09 +08:00
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);
2026-07-18 19:48:30 +08:00
@@ -2381,9 +2383,13 @@ public class ServerGamePacketListenerImpl
2026-07-09 00:03:09 +08:00
return;
}
// CraftBukkit end
- if (this.player.getInventory().getSelectedSlot() != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
- this.player.stopUsingItem();
2026-07-14 11:32:51 +08:00
+ // Shiroha start - Add item multitask config
2026-07-14 12:22:17 +08:00
+ if (!io.nanachiyo0721.shiroha.config.modules.fixes.ItemMultitaskConfig.enabled) {
2026-07-09 00:03:09 +08:00
+ if (this.player.getInventory().getSelectedSlot() != packet.getSlot() && this.player.getUsedItemHand() == InteractionHand.MAIN_HAND) {
+ this.player.stopUsingItem();
+ }
}
2026-07-14 11:32:51 +08:00
+ // Shiroha end
2026-07-09 00:03:09 +08:00
this.player.getInventory().setSelectedSlot(packet.getSlot());
this.player.resetLastActionTime();