From e430dd48f608bed74b48b3c597d659ddeec21b13 Mon Sep 17 00:00:00 2001 From: lazertester 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 84910e6..82146de 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -1148,7 +1148,7 @@ public abstract class EntityHuman extends EntityLiving { } } - this.applyExhaustion(0.1F); + this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value } else { this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ey, this.bC(), 1.0F, 1.0F); if (flag4) { @@ -1415,9 +1415,9 @@ public abstract class EntityHuman extends EntityLiving { super.cm(); this.b(StatisticList.w); if (this.isSprinting()) { - this.applyExhaustion(0.2F); + this.applyExhaustion(world.spigotConfig.jumpSprintExhaustion); // Spigot - Change to use configurable value } else { - this.applyExhaustion(0.05F); + this.applyExhaustion(world.spigotConfig.jumpWalkExhaustion); // Spigot - Change to use configurable value } } @@ -1456,13 +1456,13 @@ public abstract class EntityHuman extends EntityLiving { 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) { @@ -1473,13 +1473,13 @@ public abstract class EntityHuman extends EntityLiving { 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()) { diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index b5fd8e8..b6e9786 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -73,7 +73,7 @@ public class FoodMetaData { ++this.foodTickTimer; if (this.foodTickTimer >= 80) { entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED); // CraftBukkit - added RegainReason - this.a(6.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 index a5c7ee2..964e86e 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -249,4 +249,30 @@ public class SpigotWorldConfig largeFeatureSeed = getInt( "seed-feature", 14357617 ); log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed ); } + + public float jumpWalkExhaustion; + public float jumpSprintExhaustion; + public float combatExhaustion; + public float regenExhaustion; + public float swimMultiplier; + public float sprintMultiplier; + public float otherMultiplier; + private void initHunger() + { + if ( SpigotConfig.version < 10 ) + { + set( "hunger.walk-exhaustion", null ); + set( "hunger.sprint-exhaustion", null ); + set( "hunger.combat-exhaustion", 0.1 ); + set( "hunger.regen-exhaustion", 6.0 ); + } + + 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 ); + swimMultiplier = (float) getDouble( "hunger.swim-multiplier", 0.01 ); + sprintMultiplier = (float) getDouble( "hunger.sprint-multiplier", 0.1 ); + otherMultiplier = (float) getDouble( "hunger.other-multiplier", 0.0 ); + } } -- 2.9.3