Commits

md_5 authored 43f66f6cb76
SPIGOT-8010: Fix handling PlayerDropItemEvent
No tags

nms-patches/net/minecraft/world/inventory/Container.patch

Modified
160 160 + ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSetSlot(this.containerId, this.incrementStateId(), slot.index, slot.getItem()));
161 161 + // Updating a crafting inventory makes the client reset the result slot, have to send it again
162 162 + if (this.getBukkitView().getType() == InventoryType.WORKBENCH || this.getBukkitView().getType() == InventoryType.CRAFTING) {
163 163 + ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSetSlot(this.containerId, this.incrementStateId(), 0, this.getSlot(0).getItem()));
164 164 + }
165 165 + }
166 166 + // CraftBukkit end
167 167 }
168 168 } else {
169 169 int j2;
170 -@@ -662,8 +759,9 @@
170 +@@ -598,7 +695,11 @@
171 + }
172 +
173 + itemstack = slot2.safeTake(k, Integer.MAX_VALUE, entityhuman);
174 +- entityhuman.drop(itemstack, true);
175 ++ // CraftBukkit start - SPIGOT-8010: break loop
176 ++ if (entityhuman.drop(itemstack, true) == null) {
177 ++ break;
178 ++ }
179 ++ // CraftBukkit end
180 + entityhuman.handleCreativeModeItemDrop(itemstack);
181 + }
182 + }
183 +@@ -662,8 +763,9 @@
171 184 ItemStack itemstack = this.getCarried();
172 185
173 186 if (!itemstack.isEmpty()) {
174 187 + this.setCarried(ItemStack.EMPTY); // CraftBukkit - SPIGOT-4556 - from below
175 188 dropOrPlaceInInventory(entityhuman, itemstack);
176 189 - this.setCarried(ItemStack.EMPTY);
177 190 + // this.setCarried(ItemStack.EMPTY); // CraftBukkit - moved up
178 191 }
179 192
180 193 }
181 -@@ -893,6 +991,11 @@
194 +@@ -893,6 +995,11 @@
182 195 }
183 196
184 197 public ItemStack getCarried() {
185 198 + // CraftBukkit start
186 199 + if (this.carried.isEmpty()) {
187 200 + this.setCarried(ItemStack.EMPTY);
188 201 + }
189 202 + // CraftBukkit end
190 203 return this.carried;
191 204 }
192 205

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut