diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/effect/SaturationMobEffect.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/effect/SaturationMobEffect.patch | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/effect/SaturationMobEffect.patch b/patch-remap/og/net/minecraft/world/effect/SaturationMobEffect.patch new file mode 100644 index 0000000000..cd7fcfc9ce --- /dev/null +++ b/patch-remap/og/net/minecraft/world/effect/SaturationMobEffect.patch @@ -0,0 +1,31 @@ +--- a/net/minecraft/world/effect/SaturationMobEffect.java ++++ b/net/minecraft/world/effect/SaturationMobEffect.java +@@ -3,6 +3,11 @@ + import net.minecraft.world.entity.EntityLiving; + import net.minecraft.world.entity.player.EntityHuman; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.entity.CraftPlayer; ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++// CraftBukkit end ++ + class SaturationMobEffect extends InstantMobEffect { + + protected SaturationMobEffect(MobEffectInfo mobeffectinfo, int i) { +@@ -15,7 +20,15 @@ + if (!entityliving.level().isClientSide && entityliving instanceof EntityHuman) { + EntityHuman entityhuman = (EntityHuman) entityliving; + +- entityhuman.getFoodData().eat(i + 1, 1.0F); ++ // CraftBukkit start ++ int oldFoodLevel = entityhuman.getFoodData().foodLevel; ++ org.bukkit.event.entity.FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(entityhuman, i + 1 + oldFoodLevel); ++ if (!event.isCancelled()) { ++ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F); ++ } ++ ++ ((CraftPlayer) entityhuman.getBukkitEntity()).sendHealthUpdate(); ++ // CraftBukkit end + } + + } |