mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
22 lines
966 B
Diff
22 lines
966 B
Diff
--- a/net/minecraft/server/BlockCake.java
|
|
+++ b/net/minecraft/server/BlockCake.java
|
|
@@ -37,7 +37,18 @@
|
|
return EnumInteractionResult.PASS;
|
|
} else {
|
|
entityhuman.a(StatisticList.EAT_CAKE_SLICE);
|
|
- 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).getBukkitEntity().sendHealthUpdate();
|
|
+ // CraftBukkit end
|
|
int i = (Integer) iblockdata.get(BlockCake.BITES);
|
|
|
|
if (i < 6) {
|