Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
ce0e78c103
compile fixes compile fixes
44 Zeilen
3.0 KiB
Diff
44 Zeilen
3.0 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/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 49bec03d5be3020b451092d8c36aae8c78085174..7b129a3c34d82a43899179f2ab3b3fc4c283a989 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1230,6 +1230,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
|
|
return false;
|
|
} else {
|
|
+ // Paper start - capture all item additions to the world
|
|
+ if (captureDrops != null && entity instanceof net.minecraft.world.entity.item.ItemEntity) {
|
|
+ captureDrops.add((net.minecraft.world.entity.item.ItemEntity) entity);
|
|
+ return true;
|
|
+ }
|
|
+ // Paper end - capture all item additions to the world
|
|
// SPIGOT-6415: Don't call spawn event when reason is null. For example when an entity teleports to a new world.
|
|
if (spawnReason != null && !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
|
|
index 2f0d56c78584abe27ef050258827103fb60d5785..486d9c4dbe3ee23198eba7f34ea8b5f4e9048c0b 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -432,10 +432,12 @@ public class ServerPlayerGameMode {
|
|
// return true; // CraftBukkit
|
|
}
|
|
// CraftBukkit start
|
|
+ java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = this.level.captureDrops; // Paper - capture all item additions to the world
|
|
+ this.level.captureDrops = null; // Paper - capture all item additions to the world; Remove this earlier so that we can actually drop stuff
|
|
if (event.isDropItems()) {
|
|
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, this.level.captureDrops);
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - capture all item additions to the world
|
|
}
|
|
- this.level.captureDrops = null;
|
|
+ //this.level.captureDrops = null; // Paper - capture all item additions to the world; move up
|
|
|
|
// Drop event experience
|
|
if (flag && event != null) {
|