File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
paper-api/src/main/java/org/bukkit
paper-server/src/main/java/org/bukkit/craftbukkit/inventory Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -3001,13 +3001,14 @@ public boolean isBlock() {
30013001 }
30023002
30033003 /**
3004- * Checks if this Material is edible.
3004+ * Checks if this Material provides the {@link io.papermc.paper.datacomponent.DataComponentTypes#FOOD} and
3005+ * {@link io.papermc.paper.datacomponent.DataComponentTypes#CONSUMABLE} and, thereby, is edible by a player.
30053006 *
30063007 * @return true if this Material is edible.
30073008 */
30083009 public boolean isEdible () {
30093010 ItemType type = asItemType ();
3010- return type == null ? false : type .isEdible ();
3011+ return type != null && type .isEdible ();
30113012 }
30123013
30133014 /**
Original file line number Diff line number Diff line change @@ -3189,7 +3189,8 @@ private static <M extends ItemType> M getItemType(@KeyPattern.Value final String
31893189 short getMaxDurability ();
31903190
31913191 /**
3192- * Checks if this item type is edible.
3192+ * Checks if this item type provides the {@link io.papermc.paper.datacomponent.DataComponentTypes#FOOD} and
3193+ * {@link io.papermc.paper.datacomponent.DataComponentTypes#CONSUMABLE} and, thereby, is edible by a player.
31933194 *
31943195 * @return true if this item type is edible.
31953196 */
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ public short getMaxDurability() {
143143
144144 @ Override
145145 public boolean isEdible () {
146- return this .getHandle ().components ().has (DataComponents .FOOD );
146+ return this .getHandle ().components ().has (DataComponents .FOOD ) && this . getHandle (). components (). has ( DataComponents . CONSUMABLE ) ;
147147 }
148148
149149 @ Override
You can’t perform that action at this time.
0 commit comments