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

116 lines
5.8 KiB
Diff
Raw Normal View History

From 95b24a3ed0972ffa722b83f81bb4f34c37c40b7e 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
index e516d37bb..c374efd79 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
2017-06-12 19:24:37 +10:00
@@ -1126,7 +1126,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 {
2017-06-08 18:00:00 +10:00
this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.fx, this.bK(), 1.0F, 1.0F);
2016-03-01 08:33:06 +11:00
if (flag4) {
2017-06-12 19:24:37 +10:00
@@ -1396,9 +1396,9 @@ public abstract class EntityHuman extends EntityLiving {
2017-06-08 18:00:00 +10:00
super.cu();
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);
2016-11-26 11:51:14 +11:00
+ this.applyExhaustion(world.spigotConfig.jumpSprintExhaustion); // Spigot - Change to use configurable value
2014-08-17 19:57:08 +10:00
} else {
2016-11-17 12:41:12 +11:00
- this.applyExhaustion(0.05F);
2016-11-26 11:51:14 +11:00
+ this.applyExhaustion(world.spigotConfig.jumpWalkExhaustion); // Spigot - Change to use configurable value
2014-08-17 19:57:08 +10:00
}
}
@@ -1441,13 +1441,13 @@ public abstract class EntityHuman extends EntityLiving {
2016-11-26 11:51:14 +11:00
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.q, i);
- this.applyExhaustion(0.01F * (float) i * 0.01F);
+ this.applyExhaustion(world.spigotConfig.swimMultiplier * (float) i * 0.01F); // Spigot
}
} else if (this.isInWater()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
- this.applyExhaustion(0.01F * (float) i * 0.01F);
+ this.applyExhaustion(world.spigotConfig.swimMultiplier * (float) i * 0.01F); // Spigot
}
} else if (this.m_()) {
if (d1 > 0.0D) {
@@ -1458,13 +1458,13 @@ public abstract class EntityHuman extends EntityLiving {
2016-11-26 11:51:14 +11:00
if (i > 0) {
if (this.isSprinting()) {
this.a(StatisticList.l, i);
- this.applyExhaustion(0.1F * (float) i * 0.01F);
+ this.applyExhaustion(world.spigotConfig.sprintMultiplier * (float) i * 0.01F); // Spigot
} else if (this.isSneaking()) {
this.a(StatisticList.k, i);
- this.applyExhaustion(0.0F * (float) i * 0.01F);
+ this.applyExhaustion(world.spigotConfig.otherMultiplier * (float) i * 0.01F); // Spigot
} else {
this.a(StatisticList.j, i);
- this.applyExhaustion(0.0F * (float) i * 0.01F);
+ this.applyExhaustion(world.spigotConfig.otherMultiplier * (float) i * 0.01F); // Spigot
}
}
2017-06-08 18:00:00 +10:00
} else if (this.cP()) {
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
2017-11-17 10:24:35 +11:00
index 33a2df5d3..d42db9b45 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
2017-11-17 10:24:35 +11:00
index 5b1dc38ff..715ceefc1 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
@@ -254,4 +254,30 @@ public class SpigotWorldConfig
2017-01-26 11:23:15 +11:00
slimeSeed = getInt( "seed-slime", 987234911 );
log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed + " Monument: " + monumentSeed + " Slime: " + slimeSeed );
2014-08-17 19:57:08 +10:00
}
+
2016-11-26 11:51:14 +11:00
+ public float jumpWalkExhaustion;
+ public float jumpSprintExhaustion;
2014-08-17 19:57:08 +10:00
+ public float combatExhaustion;
+ public float regenExhaustion;
2016-11-26 11:51:14 +11:00
+ public float swimMultiplier;
+ public float sprintMultiplier;
+ public float otherMultiplier;
2014-08-17 19:57:08 +10:00
+ private void initHunger()
+ {
2016-11-26 11:51:14 +11:00
+ if ( SpigotConfig.version < 10 )
+ {
2016-11-26 11:51:14 +11:00
+ set( "hunger.walk-exhaustion", null );
+ set( "hunger.sprint-exhaustion", null );
+ set( "hunger.combat-exhaustion", 0.1 );
+ set( "hunger.regen-exhaustion", 6.0 );
+ }
+
2016-11-26 11:51:14 +11:00
+ jumpWalkExhaustion = (float) getDouble( "hunger.jump-walk-exhaustion", 0.05 );
+ jumpSprintExhaustion = (float) getDouble( "hunger.jump-sprint-exhaustion", 0.2 );
+ combatExhaustion = (float) getDouble( "hunger.combat-exhaustion", 0.1 );
+ regenExhaustion = (float) getDouble( "hunger.regen-exhaustion", 6.0 );
2016-11-26 11:51:14 +11:00
+ swimMultiplier = (float) getDouble( "hunger.swim-multiplier", 0.01 );
+ sprintMultiplier = (float) getDouble( "hunger.sprint-multiplier", 0.1 );
+ otherMultiplier = (float) getDouble( "hunger.other-multiplier", 0.0 );
2014-08-17 19:57:08 +10:00
+ }
}
--
2017-11-10 10:52:45 +11:00
2.14.1
2014-08-17 19:57:08 +10:00