Scissors/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch
Luna 3f889f5040
Slime (#136)
* Slime

* Add proper credits. Thanks ASP!

* Cleanup
2023-08-22 19:15:48 -05:00

29 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Sun, 13 Mar 2022 14:38:38 -0300
Subject: [PATCH] ItemEntity - Check if items are air before calling setItem
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 52196431a6538872755344859a0454a0e50c3b6e..2312881cdd925ec538fff3df7cdc7e04770453eb 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -425,11 +425,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
CompoundTag nbttagcompound1 = nbt.getCompound("Item");
- this.setItem(ItemStack.of(nbttagcompound1));
- if (this.getItem().isEmpty()) {
+ // Scissors start
+ ItemStack item = ItemStack.of(nbttagcompound1);
+ if (item.isEmpty()) {
this.discard();
+ return;
}
+ this.setItem(item);
+ // Scissors end
}
@Override