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:
Travis Watkins 2012-05-17 21:17:23 -05:00
parent 3ee75ab6d3
commit af89cc783f

View File

@ -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));
}