mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 20:52:12 -07:00
Validate using_converts_to for food component (#10931)
This commit is contained in:
@@ -1510,6 +1510,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.handle = new FoodProperties(this.handle.nutrition(), this.handle.saturation(), this.handle.canAlwaysEat(), eatSeconds, this.handle.usingConvertsTo(), this.handle.effects());
|
this.handle = new FoodProperties(this.handle.nutrition(), this.handle.saturation(), this.handle.canAlwaysEat(), eatSeconds, this.handle.usingConvertsTo(), this.handle.effects());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ 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());
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftFoodComponent implements FoodComponent {
|
@@ -0,0 +0,0 @@ public final class CraftFoodComponent implements FoodComponent {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user