9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-20 07:19:23 +00:00
Files
DivineMC/patches/server/0026-Fix-MC-31819.patch
2023-04-08 01:44:04 +03:00

26 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sat, 8 Apr 2023 01:13:16 +0300
Subject: [PATCH] Fix MC-31819
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.
Original bug on Mojira: 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 71c22dfc5d6b86b812a6b2be1cd7fe2338471734..61a69dff027875afae4d54c52a098de05e64d19a 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1951,6 +1951,11 @@ public abstract class Player extends LivingEntity {
}
public void causeFoodExhaustion(float f, EntityExhaustionEvent.ExhaustionReason reason) {
+ // DivineMC start - Fix MC-31819
+ if (this.level.getDifficulty() == Difficulty.PEACEFUL) {
+ return;
+ }
+ // DivineMC end
// CraftBukkit end
if (!this.abilities.invulnerable) {
if (!this.level.isClientSide) {