mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-16 15:45:23 +01:00
3e90a19183
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 304e83eb PR-1002: Improve documentation and implementation of getMaxStackSize e8215ea2 SPIGOT-7638: Library loader does not seem to resolve every dependency 79c595c0 SPIGOT-7637: Bad logic in checking nullability of AttributeModifier slots CraftBukkit Changes: 91b1fc3f1 SPIGOT-7644: Fix ItemMeta#getAsString 4e77a81e1 SPIGOT-7615: PlayerLeashEntityEvent cancelled eats lead 996f660f3 Do not remove leash knot if leasing to an existing leash knot gets cancelled f70367d42 SPIGOT-7643: Fix inverted leash event cancelled usage and remove leash knot if no entity gets leashed 7ddb48294 SPIGOT-7640: Abnormal jumping height of wind charge 080c8711e SPIGOT-7639: Incoming plugin channels not working ad549847e Open a direct connection instead of pinging mojang server to check if it is reachable 38e2926c5 SPIGOT-7365: DamageCause blocked by shield should trigger invulnerableTime
52 lines
3.4 KiB
Diff
52 lines
3.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Fri, 14 Jan 2022 10:20:40 -0800
|
|
Subject: [PATCH] Sync offhand slot in menus
|
|
|
|
Menus don't add slots for the offhand, so on sendAllDataToRemote calls the
|
|
offhand slot isn't sent. This is not correct because you *can* put stuff into the offhand
|
|
by pressing the offhand swap item
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
index d139e9e8b83ee4f075228ef0d42786c470012c2d..992032821110fc658fecc09530097a526f20d74d 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -316,6 +316,13 @@ public class ServerPlayer extends Player {
|
|
|
|
}
|
|
|
|
+ // Paper start - Sync offhand slot in menus
|
|
+ @Override
|
|
+ public void sendOffHandSlotChange() {
|
|
+ ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(ServerPlayer.this.inventoryMenu.containerId, ServerPlayer.this.inventoryMenu.incrementStateId(), net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy()));
|
|
+ }
|
|
+ // Paper end - Sync offhand slot in menus
|
|
+
|
|
@Override
|
|
public void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack) {
|
|
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(handler.containerId, handler.incrementStateId(), slot, stack));
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
index ea84d4549815ddfd2829cb2fd3885ddd1114bfa8..85fb19177690ea7235c10f64789066599db08b05 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
@@ -200,6 +200,7 @@ public abstract class AbstractContainerMenu {
|
|
|
|
if (this.synchronizer != null) {
|
|
this.synchronizer.sendInitialData(this, this.remoteSlots, this.remoteCarried, this.remoteDataSlots.toIntArray());
|
|
+ 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
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
|
index ff4fa86f9408e83e505f7e27692d3423f8570c48..a45ef5fcffc05e4e30801b73e82d29c6dbf5b8fd 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java
|
|
@@ -6,6 +6,7 @@ import net.minecraft.world.item.ItemStack;
|
|
public interface ContainerSynchronizer {
|
|
void sendInitialData(AbstractContainerMenu handler, NonNullList<ItemStack> stacks, ItemStack cursorStack, int[] properties);
|
|
|
|
+ default void sendOffHandSlotChange() {} // Paper - Sync offhand slot in menus
|
|
void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack);
|
|
|
|
void sendCarriedChange(AbstractContainerMenu handler, ItemStack stack);
|