Configurable hunger starvation damage

This commit is contained in:
Encode42
2025-01-11 23:06:24 -08:00
committed by granny
parent 58013b963c
commit 40ecc3fc06
3 changed files with 14 additions and 33 deletions

View File

@@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Tue, 29 Jun 2021 23:44:36 -0400
Subject: [PATCH] Configurable hunger starvation damage
diff --git a/net/minecraft/world/food/FoodData.java b/net/minecraft/world/food/FoodData.java
index 4f8ee2e5db3352306f3c035052866d95630f4aaf..26309851107fb80712b2dc7c5e6112cedf929003 100644
--- a/net/minecraft/world/food/FoodData.java
+++ b/net/minecraft/world/food/FoodData.java
@@ -97,7 +97,7 @@ public class FoodData {
++this.tickTimer;
if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
if (player.getHealth() > 10.0F || enumdifficulty == Difficulty.HARD || player.getHealth() > 1.0F && enumdifficulty == Difficulty.NORMAL) {
- player.hurtServer(worldserver, player.damageSources().starve(), 1.0F);
+ player.hurtServer(worldserver, player.damageSources().starve(), player.level().purpurConfig.hungerStarvationDamage); // Purpur - Configurable hunger starvation damage
}
this.tickTimer = 0;
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 7d4570b6cc775e73a64e0a7ec4fa15397636a0f3..d78c39b9db77ee6948fd87c664ab5fa5b61367ea 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -2705,4 +2705,9 @@ public class PurpurWorldConfig {
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater);
}
+
+ public float hungerStarvationDamage = 1.0F;
+ private void hungerSettings() {
+ hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
+ }
}

View File

@@ -8,3 +8,12 @@
this.add(event.getFoodLevel() - oldFoodLevel, foodProperties.saturation());
}
serverPlayer.getBukkitEntity().sendHealthUpdate();
@@ -84,7 +_,7 @@
this.tickTimer++;
if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
if (player.getHealth() > 10.0F || difficulty == Difficulty.HARD || player.getHealth() > 1.0F && difficulty == Difficulty.NORMAL) {
- player.hurtServer(serverLevel, player.damageSources().starve(), 1.0F);
+ player.hurtServer(serverLevel, player.damageSources().starve(), player.level().purpurConfig.hungerStarvationDamage); // Purpur - Configurable hunger starvation damage
}
this.tickTimer = 0;

View File

@@ -2697,4 +2697,9 @@ public class PurpurWorldConfig {
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater);
}
public float hungerStarvationDamage = 1.0F;
private void hungerSettings() {
hungerStarvationDamage = (float) getDouble("hunger.starvation-damage", hungerStarvationDamage);
}
}