2020-09-16 23:40:00 +00:00
|
|
|
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
|
2021-03-08 23:12:31 +00:00
|
|
|
index 942b38aaf1845468852ac41e9fba230837f137e3..3bae1c39bf122cec88a481b18c01c3d32d6eb747 100644
|
2020-09-16 23:40:00 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
2021-03-08 23:12:31 +00:00
|
|
|
@@ -386,10 +386,12 @@ public class PlayerInteractManager {
|
2020-09-16 23:40:00 +00:00
|
|
|
// 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
|
2021-03-08 23:12:31 +00:00
|
|
|
index dbba898b226d72d3b88695d62c711256d7e3aee2..493e3cd8a3dbc77f73dd1e026c9e580896995675 100644
|
2020-09-16 23:40:00 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
2020-11-18 03:45:18 +00:00
|
|
|
@@ -1177,6 +1177,13 @@ public class WorldServer extends World implements GeneratorAccessSeed {
|
2020-09-16 23:40:00 +00:00
|
|
|
} 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;
|
|
|
|
}
|