aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch
diff options
context:
space:
mode:
authormaxcom1 <[email protected]>2024-03-23 22:26:17 +0100
committerGitHub <[email protected]>2024-03-23 17:26:17 -0400
commitb6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch)
treea8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch
parent9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff)
downloadPaper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz
Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch')
-rw-r--r--patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch20
1 files changed, 20 insertions, 0 deletions
diff --git a/patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch b/patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch
new file mode 100644
index 0000000000..c3d0b8413a
--- /dev/null
+++ b/patches/server/0757-Prevent-empty-items-from-being-added-to-world.patch
@@ -0,0 +1,20 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Owen1212055 <[email protected]>
+Date: Wed, 15 Jun 2022 21:52:57 -0400
+Subject: [PATCH] Prevent empty items from being added to world
+
+The previous solution caused a bunch of bandaid fixes inorder to resolve edge cases where minecraft/the api might spawn items that are air.
+Just simply prevent them from being added to the world instead.
+
+diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
+index 024f32155feb31365c8233f94b1e15ed85e929fb..57f54e3399f9d2d7fecdae62858d20e50caf7afd 100644
+--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
++++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
+@@ -1231,6 +1231,7 @@ 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 {
++ if (entity instanceof net.minecraft.world.entity.item.ItemEntity itemEntity && itemEntity.getItem().isEmpty()) return false; // Paper - Prevent empty items from being added
+ // 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);