mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 15:30:19 +01:00
Validate using_converts_to for food component (#10931)
This commit is contained in:
parent
d64be7e10a
commit
081146c56e
1 changed files with 10 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue