Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
611a0ee52d
This reverts commit e38eceb42a
.
45 Zeilen
2.4 KiB
Diff
45 Zeilen
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shane Freeder <theboyetronic@gmail.com>
|
|
Date: Thu, 17 Sep 2020 00:36:05 +0100
|
|
Subject: [PATCH] Extend block drop capture to capture all items added to the
|
|
world
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
index 4b564d36135e9dbdbb57a95791f89aefd180457b..485b609bb5387b0f8a46c1201177cdc6d183ad91 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
@@ -385,10 +385,12 @@ public class PlayerInteractManager {
|
|
// return true; // CraftBukkit
|
|
}
|
|
// CraftBukkit start
|
|
+ java.util.List<EntityItem> itemsToDrop = world.captureDrops; // Paper - store current list
|
|
+ world.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
|
if (event.isDropItems()) {
|
|
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, world.captureDrops);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
|
|
}
|
|
- world.captureDrops = null;
|
|
+ //world.captureDrops = null; // Paper - move up
|
|
|
|
// Drop event experience
|
|
if (flag && event != null) {
|
|
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
|
|
index bf193badd4d7a78bcd312212b9065213db576bca..b1968103165475dd4021570e3a24deb3dc3ac796 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1176,6 +1176,13 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
|
} else if (this.isUUIDTaken(entity)) {
|
|
return false;
|
|
} else {
|
|
+ // Paper start - capture all item additions to the world
|
|
+ if (captureDrops != null && entity instanceof EntityItem) {
|
|
+ captureDrops.add((EntityItem) entity);
|
|
+ return true;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
|
|
return false;
|
|
}
|