aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0657-Fix-PlayerDropItemEvent-using-wrong-item.patch
blob: 77f6b6fccb06f781f771f3fb7edbc7abdc2e5755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 73864c47e7f13a48243478bc24d4887aa70791b3..f5905fd32f1fbbc62e4578a735aae3c45a65a3f9 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2186,7 +2186,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 a6bd94ed379ef1ab0ffe71183aef3cf3061fd092..92a5aadef076cb905962dab86f32d4ff253fef93 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -723,6 +723,11 @@ public abstract class Player extends LivingEntity {
             }
 
             double d0 = this.getEyeY() - 0.30000001192092896D;
+            // Paper start
+            ItemStack tmp = itemstack.copy();
+            itemstack.setCount(0);
+            itemstack = tmp;
+            // Paper end
             ItemEntity entityitem = new ItemEntity(this.level, this.getX(), d0, this.getZ(), itemstack);
 
             entityitem.setPickUpDelay(40);