22 lines
1.2 KiB
Diff
22 lines
1.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: etil2jz <81570777+etil2jz@users.noreply.github.com>
|
|
Date: Fri, 22 Apr 2022 18:50:49 +0200
|
|
Subject: [PATCH] Fix hunger saturation depleting on peaceful
|
|
|
|
The food saturation value is depleted on peaceful, even though
|
|
the displayed hunger bar never goes down. Hunger (or any related value, including saturation)
|
|
should not go down on peaceful. See https://bugs.mojang.com/browse/MC-31819.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
index b5ffd28b2d17014d25bc4d099b1cc5da186f3146..54e241534f0a3c00044c1ce33e7dc3a8fd020ab7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1921,6 +1921,7 @@ public abstract class Player extends LivingEntity {
|
|
}
|
|
|
|
public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {
|
|
+ if (this.level.getDifficulty() == Difficulty.PEACEFUL) return; // Mirai - fix hunger saturation depleting on peaceful
|
|
// CraftBukkit end
|
|
if (!this.abilities.invulnerable) {
|
|
if (!this.level.isClientSide) {
|