From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Sun, 20 Jun 2021 21:55:59 -0700
Subject: [PATCH] Fix PlayerDropItemEvent using wrong item


diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 77ba7fe43ceffcb816d209da45ab0c5de2112ee3..6f5be46ae4c4f53695cdc5954352a2589842ede6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2176,7 +2176,7 @@ public class ServerPlayer extends Player {
 
             if (retainOwnership) {
                 if (!itemstack1.isEmpty()) {
-                    this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), stack.getCount());
+                    this.awardStat(Stats.ITEM_DROPPED.get(itemstack1.getItem()), itemstack1.getCount()); // Paper
                 }
 
                 this.awardStat(Stats.DROP);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index ec44db1e6a6c92d8aff241b5f9acf743d3088fea..ef18f69b54b68da84f6ab9f70aa47e2f716cf9a5 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -703,6 +703,11 @@ public abstract class Player extends LivingEntity {
             }
 
             double d0 = this.getEyeY() - 0.30000001192092896D;
+            // Paper start
+            ItemStack tmp = stack.copy();
+            stack.setCount(0);
+            stack = tmp;
+            // Paper end
             ItemEntity entityitem = new ItemEntity(this.level, this.getX(), d0, this.getZ(), stack);
 
             entityitem.setPickUpDelay(40);
