From af89cc783f67b97b4dc2c170f2370b2d633f0645 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Thu, 17 May 2012 21:17:23 -0500 Subject: [PATCH] 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. --- src/main/java/net/minecraft/server/ItemFood.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java index ce6979eefe..28d1d63050 100644 --- a/src/main/java/net/minecraft/server/ItemFood.java +++ b/src/main/java/net/minecraft/server/ItemFood.java @@ -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)); }