From cf4d8fc32f6174b9a3c7aedfa4e4568411337a16 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 ebcb7bba..fc3d0539 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -1121,7 +1121,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.fx, this.bI(), 1.0F, 1.0F); if (flag4) { @@ -1391,9 +1391,9 @@ public abstract class EntityHuman extends EntityLiving { super.cs(); 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 } } @@ -1432,13 +1432,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) { @@ -1449,13 +1449,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.cN()) { diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index 489b86d4..401002b6 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 5b1dc38f..715ceefc 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -254,4 +254,30 @@ public class SpigotWorldConfig slimeSeed = getInt( "seed-slime", 987234911 ); log( "Custom Map Seeds: Village: " + villageSeed + " Feature: " + largeFeatureSeed + " Monument: " + monumentSeed + " Slime: " + slimeSeed ); } + + 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.11.0