Paper/CraftBukkit-Patches/0132-Add-Hunger-Config-Values.patch

69 lines
3.2 KiB
Diff
Raw Normal View History

2016-03-12 09:59:15 +00:00
From ab1a2c66d0382cb2bf7fe5413578a1482cf564e6 Mon Sep 17 00:00:00 2001
From: lazertester <austin.techhead@gmail.com>
Date: Sun, 17 Aug 2014 19:56:17 +1000
Subject: [PATCH] Add Hunger Config Values
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
2016-03-12 09:59:15 +00:00
index 41619c1..6e40e60 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2016-03-12 09:59:15 +00:00
@@ -1140,7 +1140,7 @@ public abstract class EntityHuman extends EntityLiving {
}
}
- this.applyExhaustion(0.3F);
+ this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value
2016-02-29 21:33:06 +00:00
} else {
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.dY, this.bz(), 1.0F, 1.0F);
if (flag4) {
2016-03-12 09:59:15 +00:00
@@ -1407,9 +1407,9 @@ public abstract class EntityHuman extends EntityLiving {
2016-02-29 21:33:06 +00:00
super.ch();
this.b(StatisticList.w);
if (this.isSprinting()) {
- this.applyExhaustion(0.8F);
+ this.applyExhaustion(world.spigotConfig.sprintExhaustion); // Spigot - Change to use configurable value
} else {
- this.applyExhaustion(0.2F);
+ this.applyExhaustion(world.spigotConfig.walkExhaustion); // Spigot - Change to use configurable value
}
2014-11-28 01:17:45 +00:00
}
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
2016-03-12 00:24:40 +00:00
index 6974045..1a24336 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
2016-03-12 00:24:40 +00:00
@@ -73,7 +73,7 @@ public class FoodMetaData {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
2016-03-12 00:24:40 +00:00
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
2016-02-29 21:33:06 +00:00
- this.a(4.0F);
+ this.a(entityhuman.world.spigotConfig.regenExhaustion); // Spigot - Change to use configurable value
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2016-02-29 21:33:06 +00:00
index 7cf8f2d..4cbcd14 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2016-02-29 21:33:06 +00:00
@@ -252,4 +252,16 @@ public class SpigotWorldConfig
largeFeatureSeed = getInt( "seed-feature", 14357617 );
log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed );
}
+
+ public float walkExhaustion;
+ public float sprintExhaustion;
+ public float combatExhaustion;
+ public float regenExhaustion;
+ private void initHunger()
+ {
+ walkExhaustion = (float) getDouble( "hunger.walk-exhaustion", 0.2 );
+ sprintExhaustion = (float) getDouble( "hunger.sprint-exhaustion", 0.8 );
+ combatExhaustion = (float) getDouble( "hunger.combat-exhaustion", 0.3 );
+ regenExhaustion = (float) getDouble( "hunger.regen-exhaustion", 3 );
+ }
}
--
2016-02-29 21:33:06 +00:00
2.5.0