spigot/CraftBukkit-Patches/0125-Add-Hunger-Config-Values.patch

69 lines
3.2 KiB
Diff
Raw Normal View History

2016-11-17 12:41:12 +11:00
From 32df62a6eee38543b2cb3b734cf274b915995c51 Mon Sep 17 00:00:00 2001
2014-08-17 19:57:08 +10:00
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-11-17 12:41:12 +11:00
index df454f1..9f115d1 100644
2014-08-17 19:57:08 +10:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2016-11-17 12:41:12 +11:00
@@ -1147,7 +1147,7 @@ public abstract class EntityHuman extends EntityLiving {
2014-08-17 19:57:08 +10:00
}
}
2016-11-17 12:41:12 +11:00
- this.applyExhaustion(0.1F);
2014-08-17 19:57:08 +10:00
+ this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value
2016-03-01 08:33:06 +11:00
} else {
2016-11-17 12:41:12 +11:00
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ey, this.bC(), 1.0F, 1.0F);
2016-03-01 08:33:06 +11:00
if (flag4) {
2016-11-17 12:41:12 +11:00
@@ -1409,9 +1409,9 @@ public abstract class EntityHuman extends EntityLiving {
super.cm();
2016-03-01 08:33:06 +11:00
this.b(StatisticList.w);
2014-08-17 19:57:08 +10:00
if (this.isSprinting()) {
2016-11-17 12:41:12 +11:00
- this.applyExhaustion(0.2F);
2014-08-17 19:57:08 +10:00
+ this.applyExhaustion(world.spigotConfig.sprintExhaustion); // Spigot - Change to use configurable value
} else {
2016-11-17 12:41:12 +11:00
- this.applyExhaustion(0.05F);
2014-08-17 19:57:08 +10:00
+ this.applyExhaustion(world.spigotConfig.walkExhaustion); // Spigot - Change to use configurable value
}
}
2014-08-17 19:57:08 +10:00
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
2016-11-17 12:41:12 +11:00
index b5fd8e8..b6e9786 100644
2014-08-17 19:57:08 +10:00
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
2016-03-12 11:24:40 +11:00
@@ -73,7 +73,7 @@ public class FoodMetaData {
++this.foodTickTimer;
2014-08-17 19:57:08 +10:00
if (this.foodTickTimer >= 80) {
2016-03-12 11:24:40 +11:00
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason
2016-11-17 12:41:12 +11:00
- this.a(6.0F);
2014-08-17 19:57:08 +10:00
+ 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-11-17 12:41:12 +11:00
index a5c7ee2..b26fb1c 100644
2014-08-17 19:57:08 +10:00
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
2016-11-17 12:41:12 +11:00
@@ -249,4 +249,16 @@ public class SpigotWorldConfig
2014-08-17 19:57:08 +10:00
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-11-17 12:41:12 +11:00
2.9.3
2014-08-17 19:57:08 +10:00