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-08-26 04:16:27 +02:00
|
|
|
index 7d97ca9449b123a82b41937353d8fd0b2c98ea4e..9c2d43c95f2f4bab0c8bbae7390500aa676ce4da 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-07-11 09:01:29 +02:00
|
|
|
@@ -1166,6 +1166,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2021-06-14 16:41:34 +02:00
|
|
|
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // 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-07-17 14:46:46 +02:00
|
|
|
index 81275857101522b2bb8824313159744036a1cc4f..2fb45e48cc5845c71cca21c43bb012f3eb6a0b53 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-06-14 16:41:34 +02:00
|
|
|
@@ -7,6 +7,7 @@ import net.minecraft.world.InteractionResult;
|
2021-06-11 14:02:28 +02:00
|
|
|
import net.minecraft.world.InteractionResultHolder;
|
|
|
|
import net.minecraft.world.MenuProvider;
|
|
|
|
import net.minecraft.world.entity.EquipmentSlot;
|
|
|
|
+import net.minecraft.world.entity.item.ItemEntity;
|
|
|
|
import net.minecraft.world.entity.player.Player;
|
|
|
|
import net.minecraft.world.item.DoubleHighBlockItem;
|
|
|
|
import net.minecraft.world.item.ItemStack;
|
2021-07-17 14:46:46 +02:00
|
|
|
@@ -424,10 +425,12 @@ public class ServerPlayerGameMode {
|
2021-06-11 14:02:28 +02:00
|
|
|
// return true; // CraftBukkit
|
|
|
|
}
|
|
|
|
// CraftBukkit start
|
|
|
|
+ java.util.List<ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
|
|
|
+ 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) {
|