papermc/Spigot-Server-Patches/0013-Player-Exhaustion-Multipliers.patch

61 lines
3.2 KiB
Diff
Raw Normal View History

2016-06-09 03:57:14 +00:00
From e74586a69790842697352759b3546ac021c0f027 Mon Sep 17 00:00:00 2001
2016-02-29 23:09:49 +00:00
From: gsand <gsandowns@gmail.com>
Date: Tue, 1 Mar 2016 13:43:16 -0600
Subject: [PATCH] Player Exhaustion Multipliers
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index a44bbed..b1d712f 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -105,4 +105,13 @@ public class PaperWorldConfig {
private void nerfedMobsShouldJump() {
nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false);
2016-02-29 23:09:49 +00:00
}
+
+ public float blockBreakExhaustion;
+ public float playerSwimmingExhaustion;
+ public void exhaustionValues() {
+ blockBreakExhaustion = getFloat("player-exhaustion.block-break", 0.025F);
+ playerSwimmingExhaustion = getFloat("player-exhaustion.swimming", 0.015F);
+ log("Player exhaustion penalty for breaking blocks is " + blockBreakExhaustion);
+ log("Player exhaustion penalty for swimming is " + playerSwimmingExhaustion);
+ }
}
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
2016-06-09 03:57:14 +00:00
index d17160a..f7cf12f 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
2016-06-09 03:57:14 +00:00
@@ -455,7 +455,7 @@ public class Block {
2016-02-29 23:09:49 +00:00
2016-05-12 02:07:46 +00:00
public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, @Nullable ItemStack itemstack) {
2016-02-29 23:09:49 +00:00
entityhuman.b(StatisticList.a(this));
- entityhuman.applyExhaustion(0.025F);
+ entityhuman.applyExhaustion(world.paperConfig.blockBreakExhaustion); // Paper - Configurable block break exhaustion
if (this.o() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0) {
ItemStack itemstack1 = this.u(iblockdata);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
2016-06-09 03:57:14 +00:00
index ca9f0fe..cbceeca 100644
2016-02-29 23:09:49 +00:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2016-06-09 03:57:14 +00:00
@@ -1464,13 +1464,13 @@ public abstract class EntityHuman extends EntityLiving {
2016-02-29 23:09:49 +00: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.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion
}
} 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.015F * (float) i * 0.01F);
+ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion
}
2016-06-09 03:57:14 +00:00
} else if (this.m_()) {
2016-02-29 23:09:49 +00:00
if (d1 > 0.0D) {
--
2016-06-09 03:57:14 +00:00
2.8.3
2016-02-29 23:09:49 +00:00