2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockCake.java
|
|
|
|
+++ b/net/minecraft/server/BlockCake.java
|
2016-05-10 13:47:39 +02:00
|
|
|
@@ -34,7 +34,18 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
private void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) {
|
2016-06-09 03:43:49 +02:00
|
|
|
if (entityhuman.m(false)) {
|
2016-02-29 22:32:46 +01:00
|
|
|
entityhuman.b(StatisticList.J);
|
2014-11-25 22:32:16 +01:00
|
|
|
- entityhuman.getFoodData().eat(2, 0.1F);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ // entityhuman.getFoodData().eat(2, 0.1F);
|
|
|
|
+ int oldFoodLevel = entityhuman.getFoodData().foodLevel;
|
|
|
|
+
|
|
|
|
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, 2 + oldFoodLevel);
|
|
|
|
+
|
|
|
|
+ if (!event.isCancelled()) {
|
|
|
|
+ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 0.1F);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
|
|
|
+ // CraftBukkit end
|
|
|
|
int i = ((Integer) iblockdata.get(BlockCake.BITES)).intValue();
|
|
|
|
|
|
|
|
if (i < 6) {
|