Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 12:30:06 +01:00
Handle inventory max stack sizes even better. Fixes BUKKIT-5595
In 7e37cf96 we modified the container logic to handle custom max stack sizes better and ensure the client stays in sync with this scenario. This had the effect of sending an extra set slot packet for every inventory click a player did which was not wanted. These extra packets also cause the client to recalculate recipes which breaks the result slot for custom recipes. To avoid the extra packets in general we now only send them if the max stack is not the one we started with. In the case of a setting a custom max stack size on a workbench this is still not enough so we also now send another extra packet to make sure the result slot is always correct.
Dieser Commit ist enthalten in:
Ursprung
5610337b4f
Commit
65a6e97785
@ -13,6 +13,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.event.Event.Result;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -346,8 +347,12 @@ public abstract class Container {
|
||||
|
||||
slot2.f();
|
||||
// CraftBukkit start - Make sure the client has the right slot contents
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
if (entityhuman instanceof EntityPlayer && slot2.getMaxStackSize() != 64) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, slot2.rawSlotIndex, slot2.getItem()));
|
||||
// Updating a crafting inventory makes the client reset the result slot, have to send it again
|
||||
if (this.getBukkitView().getType() == InventoryType.WORKBENCH || this.getBukkitView().getType() == InventoryType.CRAFTING) {
|
||||
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, this.getSlot(0).getItem()));
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren