PaperSpigot-Parent/Spigot-Server-Patches/0022-Player-Exhaustion-Mult...

118 lines
6.6 KiB
Diff
Raw Normal View History

2014-08-06 01:45:22 +02:00
From 9471d677129b9aebaa0045bb39f128ace1769b46 Mon Sep 17 00:00:00 2001
2014-07-07 02:18:38 +02:00
From: gsand <gsandowns@gmail.com>
2014-08-06 01:45:22 +02:00
Date: Tue, 5 Aug 2014 18:28:21 -0500
2014-07-07 02:18:38 +02:00
Subject: [PATCH] Player Exhaustion Multipliers
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
2014-08-06 01:45:22 +02:00
index 0893a6f..acb9c54 100644
2014-07-07 02:18:38 +02:00
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
2014-08-06 01:45:22 +02:00
@@ -686,7 +686,7 @@ public class Block {
2014-07-07 02:18:38 +02:00
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
2014-07-09 05:05:35 +02:00
entityhuman.a(StatisticList.MINE_BLOCK_COUNT[getId(this)], 1);
- entityhuman.applyExhaustion(0.025F);
2014-08-06 01:45:22 +02:00
+ entityhuman.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionBlockBreak); // PaperSpigot - Configurable block breaking exhaustion
2014-07-07 02:18:38 +02:00
if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.j(l);
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
2014-08-06 01:45:22 +02:00
index c0355bc..08987f2 100644
2014-07-07 02:18:38 +02:00
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
2014-08-06 01:45:22 +02:00
@@ -1006,7 +1006,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
2014-07-07 02:18:38 +02:00
}
}
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.3F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionAttack); // PaperSpigot - Configurable attack exhaustion
2014-07-07 02:18:38 +02:00
} else if (flag1) {
entity.extinguish();
}
2014-08-06 01:45:22 +02:00
@@ -1266,9 +1266,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
2014-07-09 05:05:35 +02:00
super.bj();
2014-07-07 02:18:38 +02:00
this.a(StatisticList.r, 1);
if (this.isSprinting()) {
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.8F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionSprintJumping); // PaperSpigot - Configurable sprint jumping exhaustion
2014-07-07 02:18:38 +02:00
} else {
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.2F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionJumping); // PaperSpigot - Configurable jumping exhaustion
2014-07-07 02:18:38 +02:00
}
}
2014-08-06 01:45:22 +02:00
@@ -1304,13 +1304,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
2014-07-07 02:18:38 +02:00
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.015F * (float) i * 0.01F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionSwimming * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion
2014-07-07 02:18:38 +02:00
}
2014-07-09 05:05:35 +02:00
} else if (this.M()) {
2014-07-07 02:18:38 +02:00
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.i, i);
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.015F * (float) i * 0.01F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionSwimming * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion
2014-07-07 02:18:38 +02:00
}
} else if (this.h_()) {
if (d1 > 0.0D) {
2014-08-06 01:45:22 +02:00
@@ -1321,9 +1321,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
2014-07-07 02:18:38 +02:00
if (i > 0) {
this.a(StatisticList.h, i);
if (this.isSprinting()) {
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.099999994F * (float) i * 0.01F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionSprinting * (float) i * 0.01F); // PaperSpigot - Configurable sprinting exhaustion
2014-07-07 02:18:38 +02:00
} else {
2014-07-09 05:05:35 +02:00
- this.applyExhaustion(0.01F * (float) i * 0.01F);
2014-08-06 01:45:22 +02:00
+ this.applyExhaustion(org.github.paperspigot.PaperSpigotConfig.playerExhaustionWalking * (float) i * 0.01F); // PaperSpigot - Configurable walking exhaustion
2014-07-07 02:18:38 +02:00
}
}
} else {
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
2014-08-06 01:45:22 +02:00
index 4169231..0189c99 100644
2014-07-07 02:18:38 +02:00
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
2014-08-06 01:45:22 +02:00
@@ -65,7 +65,7 @@ public class FoodMetaData {
2014-07-07 02:18:38 +02:00
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
- this.a(3.0F);
2014-08-06 01:45:22 +02:00
+ this.a(org.github.paperspigot.PaperSpigotConfig.playerExhaustionRegeneration); // PaperSpigot - Configurable regeneration exhaustion
2014-07-07 02:18:38 +02:00
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {
2014-08-06 01:45:22 +02:00
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
index 25a94a6..89bb1ca 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java
@@ -161,4 +161,24 @@ public class PaperSpigotConfig
Bukkit.getLogger().log( Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users" );
}
2014-07-07 02:18:38 +02:00
}
+
+ public static float playerExhaustionWalking;
+ public static float playerExhaustionSwimming;
+ public static float playerExhaustionBlockBreak;
+ public static float playerExhaustionSprinting;
+ public static float playerExhaustionJumping;
+ public static float playerExhaustionSprintJumping;
+ public static float playerExhaustionAttack;
+ public static float playerExhaustionRegeneration;
2014-08-06 01:45:22 +02:00
+ private static void playerExhaustion()
2014-07-07 02:18:38 +02:00
+ {
+ playerExhaustionWalking = getFloat( "player-exhaustion.walking", 0.01F );
+ playerExhaustionSwimming = getFloat( "player-exhaustion.swimming", 0.015F );
+ playerExhaustionBlockBreak = getFloat( "player-exhaustion.block-break", 0.025F );
+ playerExhaustionSprinting = getFloat( "player-exhaustion.sprinting", 0.1F );
+ playerExhaustionJumping = getFloat( "player-exhaustion.jumping", 0.2F );
+ playerExhaustionSprintJumping = getFloat( "player-exhaustion.sprint-jumping", 0.8F );
+ playerExhaustionAttack = getFloat( "player-exhaustion.attack", 0.3F );
+ playerExhaustionRegeneration = getFloat( "player-exhaustion.regeneration", 3.0F );
+ }
}
--
1.9.1