diff options
author | Nassim Jahnke <[email protected]> | 2023-12-05 18:20:55 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2023-12-05 18:20:55 +0100 |
commit | 2a1ace0cf289870e82d23cf6cbcd87493f26a188 (patch) | |
tree | 415a047c3b8bcc17146f144815b1db15e0500ae6 /patches/api/0441-Allow-proper-checking-of-empty-item-stacks.patch | |
parent | 931781c220b98dde0159c9a3c8dce06c3b2b1e13 (diff) | |
download | Paper-2a1ace0cf289870e82d23cf6cbcd87493f26a188.tar.gz Paper-2a1ace0cf289870e82d23cf6cbcd87493f26a188.zip |
Prepare for 1.20.3 dev
Diffstat (limited to 'patches/api/0441-Allow-proper-checking-of-empty-item-stacks.patch')
-rw-r--r-- | patches/api/0441-Allow-proper-checking-of-empty-item-stacks.patch | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/patches/api/0441-Allow-proper-checking-of-empty-item-stacks.patch b/patches/api/0441-Allow-proper-checking-of-empty-item-stacks.patch deleted file mode 100644 index e4c35df87b..0000000000 --- a/patches/api/0441-Allow-proper-checking-of-empty-item-stacks.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aeltumn <[email protected]> -Date: Mon, 28 Aug 2023 13:41:09 +0200 -Subject: [PATCH] Allow proper checking of empty item stacks - -This adds a method to check if an item stack is empty or not. This mirrors vanilla's implementation of the same method. - -diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java -index d15a74c38576c49df61cfab02c70fc5d8c0dd5f7..0af73cc04edb93b9772136d4d808f657ea40e733 100644 ---- a/src/main/java/org/bukkit/inventory/ItemStack.java -+++ b/src/main/java/org/bukkit/inventory/ItemStack.java -@@ -985,5 +985,24 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat - public @NotNull ItemStack damage(int amount, @NotNull org.bukkit.entity.LivingEntity livingEntity) { - return livingEntity.damageItemStack(this, amount); - } -+ -+ /** -+ * Returns an empty item stack, consists of an air material and a stack size of 0. -+ * -+ * Any item stack with a material of air or a stack size of 0 is seen -+ * as being empty by {@link ItemStack#isEmpty}. -+ */ -+ @NotNull -+ public static ItemStack empty() { -+ return new ItemStack(); -+ } -+ -+ /** -+ * Returns whether this item stack is empty and contains no item. This means -+ * it is either air or the stack has a size of 0. -+ */ -+ public boolean isEmpty() { -+ return type.isAir() || amount <= 0; -+ } - // Paper end - } |