aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0970-General-ItemMeta-fixes.patch
diff options
context:
space:
mode:
authorLulu13022002 <[email protected]>2024-06-21 18:48:48 +0200
committerGitHub <[email protected]>2024-06-21 18:48:48 +0200
commit081146c56e45caa7b00bfeaac6b2ad89aaecccf2 (patch)
tree33d2a030486491a2aec7a1d1e113bfbc4c81b528 /patches/server/0970-General-ItemMeta-fixes.patch
parentd64be7e10ae67eaa85f1fad0637488cd70da80ea (diff)
downloadPaper-081146c56e45caa7b00bfeaac6b2ad89aaecccf2.tar.gz
Paper-081146c56e45caa7b00bfeaac6b2ad89aaecccf2.zip
Validate using_converts_to for food component (#10931)
Diffstat (limited to 'patches/server/0970-General-ItemMeta-fixes.patch')
-rw-r--r--patches/server/0970-General-ItemMeta-fixes.patch12
1 files changed, 10 insertions, 2 deletions
diff --git a/patches/server/0970-General-ItemMeta-fixes.patch b/patches/server/0970-General-ItemMeta-fixes.patch
index ad2f78a179..1f0a2364a7 100644
--- a/patches/server/0970-General-ItemMeta-fixes.patch
+++ b/patches/server/0970-General-ItemMeta-fixes.patch
@@ -1499,7 +1499,7 @@ index 8b407a33b04af6ae396ada0b8aca7dc246d314ef..d204845cf0b9de00589593469755cb8e
+ // Paper end - General ItemMeta Fixes
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java
-index 63fc9138dc3388ceb9acf672b3f75ba0976e8e54..cad52601583c1f304f94de954c4d18a6005906e3 100644
+index 63fc9138dc3388ceb9acf672b3f75ba0976e8e54..5986aa3588487c2caef4c895f8883e38a674b61c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/components/CraftFoodComponent.java
@@ -109,6 +109,7 @@ public final class CraftFoodComponent implements FoodComponent {
@@ -1510,7 +1510,15 @@ index 63fc9138dc3388ceb9acf672b3f75ba0976e8e54..cad52601583c1f304f94de954c4d18a6
this.handle = new FoodProperties(this.handle.nutrition(), this.handle.saturation(), this.handle.canAlwaysEat(), eatSeconds, this.handle.usingConvertsTo(), this.handle.effects());
}
-@@ -134,6 +135,7 @@ public final class CraftFoodComponent implements FoodComponent {
+@@ -119,6 +120,7 @@ public final class CraftFoodComponent implements FoodComponent {
+
+ @Override
+ public void setUsingConvertsTo(ItemStack item) {
++ Preconditions.checkArgument(item == null || !item.isEmpty(), "Item cannot be empty"); // Paper - validate using_converts_to
+ this.handle = new FoodProperties(this.handle.nutrition(), this.handle.saturation(), this.handle.canAlwaysEat(), this.handle.eatSeconds(), Optional.ofNullable(item).map(CraftItemStack::asNMSCopy), this.handle.effects());
+ }
+
+@@ -134,6 +136,7 @@ public final class CraftFoodComponent implements FoodComponent {
@Override
public FoodEffect addEffect(PotionEffect effect, float probability) {