2021-06-11 14:02:28 +02: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/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2021-11-29 12:55:13 +01:00
|
|
|
index ad4904aff037fd916ef5481dc5516781ad078330..00a64168592ad2c8cecb2fc844d81e47610601ad 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2021-11-26 17:25:35 +01:00
|
|
|
@@ -1257,6 +1257,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2021-11-24 17:39:04 +01:00
|
|
|
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
|
2021-06-11 14:02:28 +02:00
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
+ // Paper start - capture all item additions to the world
|
2021-06-14 16:41:34 +02:00
|
|
|
+ if (captureDrops != null && entity instanceof net.minecraft.world.entity.item.ItemEntity) {
|
|
|
|
+ captureDrops.add((net.minecraft.world.entity.item.ItemEntity) entity);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
2021-11-29 12:55:13 +01:00
|
|
|
index 4f1430c71aff4959b1db76200fe750a6c44cef68..01b19225193ef3a3f69291f0357c096fc9e71618 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
2021-11-29 12:55:13 +01:00
|
|
|
@@ -423,10 +423,12 @@ public class ServerPlayerGameMode {
|
2021-06-11 14:02:28 +02:00
|
|
|
// return true; // CraftBukkit
|
|
|
|
}
|
|
|
|
// CraftBukkit start
|
2021-11-24 17:39:04 +01:00
|
|
|
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
2021-06-11 14:02:28 +02:00
|
|
|
+ level.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, level.captureDrops);
|
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
|
|
|
|
}
|
|
|
|
- level.captureDrops = null;
|
|
|
|
+ //world.captureDrops = null; // Paper - move up
|
|
|
|
|
|
|
|
// Drop event experience
|
|
|
|
if (flag && event != null) {
|