aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0681-Fix-PlayerDropItemEvent-using-wrong-item.patch
blob: 6ae023df0a2989db44ee84d47e1d00e5d8719636 (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 f1661e228ed982f38e0bc3e9e0c1720608e0b4a4..ca9a30a279e7d12c63b351e437fb9dcc11e2ed56 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2174,7 +2174,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 f4c861c86b718d67ae13ac02c6d1f20433312725..be2f492343770af9d360c4e7ed7495d196b2424c 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -713,6 +713,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);