mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
Don't cap food level at 20 when eating. Fixes BUKKIT-1667
The amount of food gained when eating is used for calculating the food saturation value so capping it at 20 at this point causes us to get incorrect results. FoodMetaData.eat caps it at 20 anyway so we're safe to not do so here. Also readds a line from mc-dev that was mistakenly removed.
This commit is contained in:
parent
3ee75ab6d3
commit
af89cc783f
1 changed files with 2 additions and 1 deletions
|
@ -29,13 +29,14 @@ public class ItemFood extends Item {
|
|||
// CraftBukkit start
|
||||
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
|
||||
|
||||
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, Math.min(this.getNutrition() + oldFoodLevel, 20));
|
||||
org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, this.getNutrition() + oldFoodLevel);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, this.getSaturationModifier());
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
world.makeSound(entityhuman, "random.burp", 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
if (!world.isStatic && this.bX > 0 && world.random.nextFloat() < this.ca) {
|
||||
entityhuman.addEffect(new MobEffect(this.bX, this.bY * 20, this.bZ));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue