diff --git a/src/main/java/cn/nukkit/Player.java b/src/main/java/cn/nukkit/Player.java index fa43cdc50a9..383c1bc0c48 100644 --- a/src/main/java/cn/nukkit/Player.java +++ b/src/main/java/cn/nukkit/Player.java @@ -4171,6 +4171,7 @@ public boolean attack(EntityDamageEvent source) { ((Player) damager).getFoodData().updateFoodExpLevel(0.3); } } + this.getFoodData().updateFoodExpLevel(0.1); EntityEventPacket pk = new EntityEventPacket(); pk.eid = this.id; pk.event = EntityEventPacket.HURT_ANIMATION; diff --git a/src/main/java/cn/nukkit/PlayerFood.java b/src/main/java/cn/nukkit/PlayerFood.java index 40ceb867c9b..1c1757466fd 100644 --- a/src/main/java/cn/nukkit/PlayerFood.java +++ b/src/main/java/cn/nukkit/PlayerFood.java @@ -171,12 +171,15 @@ public void update(int tickDiff) { } public void updateFoodExpLevel(double use) { - if (!this.getPlayer().isFoodEnabled()) return; if (Server.getInstance().getDifficulty() == 0) return; if (this.getPlayer().hasEffect(Effect.SATURATION)) return; this.foodExpLevel += use; if (this.foodExpLevel > 4) { - this.useHunger(1); + if (!this.getPlayer().isFoodEnabled()) { + this.sendFoodLevel(); + } else { + this.useHunger(1); + } this.foodExpLevel = 0; } }