Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions paper-api/src/main/java/org/bukkit/Material.java
Original file line number Diff line number Diff line change
Expand Up @@ -3001,13 +3001,14 @@ public boolean isBlock() {
}

/**
* Checks if this Material is edible.
* Checks if this Material provides the {@link io.papermc.paper.datacomponent.DataComponentTypes#FOOD} and
* {@link io.papermc.paper.datacomponent.DataComponentTypes#CONSUMABLE} and, thereby, is edible by a player.
*
* @return true if this Material is edible.
*/
public boolean isEdible() {
ItemType type = asItemType();
return type == null ? false : type.isEdible();
return type != null && type.isEdible();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3189,7 +3189,8 @@ private static <M extends ItemType> M getItemType(@KeyPattern.Value final String
short getMaxDurability();

/**
* Checks if this item type is edible.
* Checks if this item type provides the {@link io.papermc.paper.datacomponent.DataComponentTypes#FOOD} and
* {@link io.papermc.paper.datacomponent.DataComponentTypes#CONSUMABLE} and, thereby, is edible by a player.
*
* @return true if this item type is edible.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public short getMaxDurability() {

@Override
public boolean isEdible() {
return this.getHandle().components().has(DataComponents.FOOD);
return this.getHandle().components().has(DataComponents.FOOD) && this.getHandle().components().has(DataComponents.CONSUMABLE);
}

@Override
Expand Down
Loading