13
0
geforkt von Mirrors/Paper
Paper/nms-patches/BlockCake.patch

23 Zeilen
966 B
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockCake.java
+++ b/net/minecraft/server/BlockCake.java
2019-12-10 23:00:00 +01:00
@@ -37,7 +37,18 @@
return EnumInteractionResult.PASS;
2016-11-17 02:41:03 +01:00
} else {
2018-07-15 02:00:00 +02:00
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
2018-12-06 00:00:00 +01:00
int i = (Integer) iblockdata.get(BlockCake.BITES);
if (i < 6) {