summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-09-22 15:38:25 -0400
committerEvilSeph <evilseph@gmail.com>2011-09-22 15:53:39 -0400
commite08535d68853d48388accc0a4f3c7504c2d15bf9 (patch)
tree91dee55cb5716fabf2af5d980a7c92a2aff42398 /src/main/java/net/minecraft/server
parenta7717d4d795f028d331f24138dd0935c03910edd (diff)
downloadcraftbukkit-e08535d68853d48388accc0a4f3c7504c2d15bf9.tar
craftbukkit-e08535d68853d48388accc0a4f3c7504c2d15bf9.tar.gz
craftbukkit-e08535d68853d48388accc0a4f3c7504c2d15bf9.tar.lz
craftbukkit-e08535d68853d48388accc0a4f3c7504c2d15bf9.tar.xz
craftbukkit-e08535d68853d48388accc0a4f3c7504c2d15bf9.zip
Fixed FoodLevelChange event adding too much to the food level.
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 cfafbb6c..de2baffa 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -29,11 +29,12 @@ public class ItemFood extends Item {
public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) {
--itemstack.count;
// CraftBukkit start
- FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.k() + entityhuman.foodData.foodLevel, 20));
+ 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().a(event.getFoodLevel(), this.l());
+ 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);
}
// CraftBukkit end