mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
b3a8254758
By: md_5 <git@md-5.net>
22 lines
1 KiB
Diff
22 lines
1 KiB
Diff
--- a/net/minecraft/world/level/block/BlockCake.java
|
|
+++ b/net/minecraft/world/level/block/BlockCake.java
|
|
@@ -86,7 +86,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);
|
|
+ }
|
|
+
|
|
+ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate();
|
|
+ // CraftBukkit end
|
|
int i = (Integer) iblockdata.get(BlockCake.BITES);
|
|
|
|
generatoraccess.a((Entity) entityhuman, GameEvent.EAT, blockposition);
|