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 d309e2c460654c2fa7a6668e9f31d330e8e35967..3833c0c863c49c2ff5552030e7a0799cf2ec0614 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2161,7 +2161,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 3e462d68ce5fa37735c5328997767fa1ef3b869d..fb66da46d2b3a46fe4b8d43f99a1a60f768f5f19 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -705,6 +705,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);