Paper/patches/server/0559-Drop-carried-item-when-player-has-disconnected.patch
Jake Potrebic 1e7dd72f15
Remove 'fix Vanilla Minecart speed' patch (#10068)
The game uses 0.95d now
2023-12-22 17:44:36 -08:00

28 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dmitry Sidorov <jonmagon@gmail.com>
Date: Thu, 4 Feb 2021 20:32:01 +0300
Subject: [PATCH] Drop carried item when player has disconnected
Fixes disappearance of held items, when a player gets disconnected and PlayerDropItemEvent is cancelled.
Closes #5036
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c8f40d71619a53f85b71ef5af397bbfa65fd797f..59d847b87d7d35598231a1352a1a1ed32f38c176 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -597,6 +597,14 @@ public abstract class PlayerList {
}
// Paper end
+ // Paper - Drop carried item when player has disconnected
+ if (!entityplayer.containerMenu.getCarried().isEmpty()) {
+ net.minecraft.world.item.ItemStack carried = entityplayer.containerMenu.getCarried();
+ entityplayer.containerMenu.setCarried(net.minecraft.world.item.ItemStack.EMPTY);
+ entityplayer.drop(carried, false);
+ }
+ // Paper end
+
this.save(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();