summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-09-26 14:17:32 -0400
committerEvilSeph <evilseph@gmail.com>2011-09-26 14:33:37 -0400
commit484376bbac625ee595b850d88d22162772ea7606 (patch)
tree59b7078b90816efab6260220b1dc857430fb55c6 /src/main/java/net/minecraft/server
parent31eef6e001dad501670337ae042dcb64c1068783 (diff)
downloadcraftbukkit-484376bbac625ee595b850d88d22162772ea7606.tar
craftbukkit-484376bbac625ee595b850d88d22162772ea7606.tar.gz
craftbukkit-484376bbac625ee595b850d88d22162772ea7606.tar.lz
craftbukkit-484376bbac625ee595b850d88d22162772ea7606.tar.xz
craftbukkit-484376bbac625ee595b850d88d22162772ea7606.zip
Fixed saturation handling for FoodLevelChange event.
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/ItemFood.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
index dd02041f..de922f2c 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -29,12 +29,13 @@ public class ItemFood extends Item {
public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) {
--itemstack.count;
// CraftBukkit start
+ int oldFoodLevel = entityhuman.getFoodData().foodLevel;
+
FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.k() + entityhuman.getFoodData().foodLevel, 20));
entityhuman.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- entityhuman.getFoodData().foodLevel = event.getFoodLevel();
- entityhuman.getFoodData().saturationLevel = Math.min(entityhuman.getFoodData().saturationLevel + (float) event.getFoodLevel() - entityhuman.getFoodData().foodLevel * this.l() * 2.0F, (float) entityhuman.getFoodData().foodLevel);
+ entityhuman.getFoodData().a(event.getFoodLevel() - oldFoodLevel, this.l());
}
// CraftBukkit end