Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 13:00:06 +01:00
Fire FoodLevelChangeEvent when eating cake. Fixes BUKKIT-2242
Dieser Commit ist enthalten in:
Ursprung
3fb4ccb62c
Commit
6482b6f0bd
@ -53,7 +53,17 @@ public class BlockCake extends Block {
|
||||
|
||||
private void b(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (entityhuman.g(false)) {
|
||||
entityhuman.getFoodData().eat(2, 0.1F);
|
||||
// CraftBukkit start
|
||||
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).playerConnection.sendPacket(new Packet8UpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
// CraftBukkit end
|
||||
int l = world.getData(i, j, k) + 1;
|
||||
|
||||
if (l >= 6) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren