From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Spottedleaf 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 aec3fd5bd9103af17eb476d5411b84d76f72bfe4..d3984faa2566e61eeb6c77b327f3ea951c8c8179 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2158,7 +2158,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 6f406d8d945f3938961fe1a0df42f8cb558d8716..44c2820a33ed40b4ef2ebd20708347d3cc2437ae 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);