aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/level/block/BlockCake.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/BlockCake.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/level/block/BlockCake.patch22
1 files changed, 22 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/BlockCake.patch b/patch-remap/og/net/minecraft/world/level/block/BlockCake.patch
new file mode 100644
index 0000000000..f35b847b9c
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/level/block/BlockCake.patch
@@ -0,0 +1,22 @@
+--- a/net/minecraft/world/level/block/BlockCake.java
++++ b/net/minecraft/world/level/block/BlockCake.java
+@@ -92,7 +92,18 @@
+ return EnumInteractionResult.PASS;
+ } else {
+ entityhuman.awardStat(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);
++ }
++
++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate();
++ // CraftBukkit end
+ int i = (Integer) iblockdata.getValue(BlockCake.BITES);
+
+ generatoraccess.gameEvent((Entity) entityhuman, GameEvent.EAT, blockposition);