9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-24 01:09:16 +00:00

fix sending the sword blocking animation when block-with-swords is disabled

This commit is contained in:
Samsuik
2025-08-14 21:17:43 +01:00
parent bf7e63debc
commit f8a30242f3
3 changed files with 28 additions and 1 deletions

View File

@@ -1,5 +1,14 @@
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -296,7 +_,7 @@
// Paper start - Sync offhand slot in menus
@Override
public void sendOffHandSlotChange() {
- this.sendSlotChange(ServerPlayer.this.inventoryMenu, net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy());
+ this.sendSlotChange(ServerPlayer.this.inventoryMenu, net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copyForPacket()); // Sakura - modify components sent to the client
}
// Paper end - Sync offhand slot in menus
@@ -429,6 +_,7 @@
public boolean isRealPlayer; // Paper
public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent

View File

@@ -18,3 +18,21 @@
this.synchronizer.sendOffHandSlotChange(); // Paper - Sync offhand slot in menus; update player's offhand since the offhand slot is not added to the slots for menus but can be changed by swapping from a menu slot
}
}
@@ -239,7 +_,7 @@
ItemStack carried = this.getCarried();
this.remoteCarried.force(carried);
if (this.synchronizer != null) {
- this.synchronizer.sendCarriedChange(this, carried.copy());
+ this.synchronizer.sendCarriedChange(this, carried.copyForPacket()); // Sakura - modify components sent to the client
}
}
// CraftBukkit end
@@ -343,7 +_,7 @@
if (!this.remoteCarried.matches(carried)) {
this.remoteCarried.force(carried);
if (this.synchronizer != null) {
- this.synchronizer.sendCarriedChange(this, carried.copy());
+ this.synchronizer.sendCarriedChange(this, carried.copyForPacket()); // Sakura - modify components sent to the client
}
}
}

View File

@@ -30,7 +30,7 @@ public final class BlockableSwordItem extends Item {
@Override
public void modifyComponentsSentToClient(PatchedDataComponentMap components) {
if (hasCustomAnimationOrDisabled(components)) {
if (!hasCustomAnimationOrDisabled(components)) {
// When updating to 1.22 change CONSUMABLE to BLOCK_ATTACKS
components.set(DataComponents.CONSUMABLE, BLOCKING_ANIMATION);
}