mirror of
https://github.com/PaperMC/Paper.git
synced 2025-12-05 04:54:44 +01:00
fix: always set carried item after successful InventoryDragEvent
This commit is contained in:
parent
b96f4d4d62
commit
006317816a
@ -107,7 +107,7 @@
|
||||
|
||||
for (Slot slot1 : this.quickcraftSlots) {
|
||||
ItemStack carried1 = this.getCarried();
|
||||
@@ -385,12 +_,46 @@
|
||||
@@ -385,12 +_,42 @@
|
||||
int min = Math.min(itemStack.getMaxStackSize(), slot1.getMaxStackSize(itemStack));
|
||||
int min1 = Math.min(getQuickCraftPlaceCount(this.quickcraftSlots, this.quickcraftType, itemStack) + i2, min);
|
||||
count -= min1 - i2;
|
||||
@ -148,11 +148,7 @@
|
||||
+ for (final it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry<net.minecraft.world.item.ItemStack> entry : draggedSlots.int2ObjectEntrySet()) {
|
||||
+ view.setItem(entry.getIntKey(), org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(entry.getValue()));
|
||||
+ }
|
||||
+ // The only time the carried item will be set to empty is if the inventory is closed by the server.
|
||||
+ // If the inventory is closed by the server, then the cursor items are dropped. This is why we change the cursor early.
|
||||
+ if (!this.getCarried().isEmpty()) {
|
||||
+ this.setCarried(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getCursor()));
|
||||
+ }
|
||||
+ this.setCarried(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getCursor()));
|
||||
+ } else {
|
||||
+ this.setCarried(oldCarried);
|
||||
+ }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user