aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CakeBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CakeBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CakeBlock.java.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CakeBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CakeBlock.java.patch
new file mode 100644
index 0000000000..8da72b433f
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/CakeBlock.java.patch
@@ -0,0 +1,27 @@
+--- a/net/minecraft/world/level/block/CakeBlock.java
++++ b/net/minecraft/world/level/block/CakeBlock.java
+@@ -95,10 +92,21 @@
+ return InteractionResult.PASS;
+ } else {
+ player.awardStat(Stats.EAT_CAKE_SLICE);
+- player.getFoodData().eat(2, 0.1F);
+- int i = (Integer) blockstate.getValue(CakeBlock.BITES);
++ // CraftBukkit start
++ // entityhuman.getFoodData().eat(2, 0.1F);
++ int oldFoodLevel = player.getFoodData().foodLevel;
+
+- levelaccessor.gameEvent((Entity) player, GameEvent.EAT, blockpos);
++ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(player, 2 + oldFoodLevel);
++
++ if (!event.isCancelled()) {
++ player.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 0.1F);
++ }
++
++ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().sendHealthUpdate();
++ // CraftBukkit end
++ int i = (Integer) state.getValue(CakeBlock.BITES);
++
++ level.gameEvent((Entity) player, GameEvent.EAT, pos);
+ if (i < 6) {
+ levelaccessor.setBlock(blockpos, (BlockState) blockstate.setValue(CakeBlock.BITES, i + 1), 3);
+ } else {