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

116 lines
5.8 KiB
Diff
Raw Normal View History

2016-12-21 07:00:00 +11:00
From e430dd48f608bed74b48b3c597d659ddeec21b13 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-12-21 07:00:00 +11:00
index 84910e6..82146de 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-12-21 07:00:00 +11:00
@@ -1148,7 +1148,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-12-21 07:00:00 +11:00
@@ -1415,9 +1415,9 @@ public abstract class EntityHuman extends EntityLiving {
2016-11-17 12:41:12 +11:00
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);
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
}
}
2016-12-21 07:00:00 +11:00
@@ -1456,13 +1456,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) {
2016-12-21 07:00:00 +11:00
@@ -1473,13 +1473,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
}
}
} else if (this.cH()) {
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-26 11:51:14 +11:00
index a5c7ee2..964e86e 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-26 11:51:14 +11:00
@@ -249,4 +249,30 @@ public class SpigotWorldConfig
2014-08-17 19:57:08 +10:00
largeFeatureSeed = getInt( "seed-feature", 14357617 );
log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed );
}
+
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
+ }
}
--
2016-11-17 12:41:12 +11:00
2.9.3
2014-08-17 19:57:08 +10:00