mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Configurable hunger starvation damage
This commit is contained in:
@@ -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);
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
@@ -8,3 +8,12 @@
|
|||||||
this.add(event.getFoodLevel() - oldFoodLevel, foodProperties.saturation());
|
this.add(event.getFoodLevel() - oldFoodLevel, foodProperties.saturation());
|
||||||
}
|
}
|
||||||
serverPlayer.getBukkitEntity().sendHealthUpdate();
|
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;
|
||||||
|
|||||||
@@ -2697,4 +2697,9 @@ public class PurpurWorldConfig {
|
|||||||
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
|
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
|
||||||
zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user