3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 23:00:08 +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.
Dieser Commit ist enthalten in:
Travis Watkins 2012-05-17 21:17:23 -05:00
Ursprung 3ee75ab6d3
Commit af89cc783f

Datei anzeigen

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