Paper/CraftBukkit-Patches/0021-Player-Exhaustion-Multipliers.patch
2014-07-08 18:26:32 -05:00

135 lines
6.8 KiB
Diff

From 36c586d93bb138448fc82a3dfb9b52c85893dcd8 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Sun, 6 Jul 2014 06:42:49 -0400
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
index aaead32..51f0ab5 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -4,6 +4,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
+import org.github.paperspigot.PaperSpigotWorldConfig; // PaperSpigot
+
public class Block {
public static final RegistryMaterials REGISTRY = new RegistryBlocks("air");
@@ -686,7 +688,7 @@ public class Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.MINE_BLOCK_COUNT[b(this)], 1);
- entityhuman.a(0.025F);
+ entityhuman.a( PaperSpigotWorldConfig.playerExhaustionBlockBreak ); // PaperSpigot - Configurable block breaking exhaustion
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
index eb123ff..ad3b0a1 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -996,7 +996,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.a(0.3F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionAttack ); // PaperSpigot - Configurable attack exhaustion
} else if (flag1) {
entity.extinguish();
}
@@ -1256,9 +1256,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
super.bi();
this.a(StatisticList.r, 1);
if (this.isSprinting()) {
- this.a(0.8F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionSprintJumping ); // PaperSpigot - Configurable sprint jumping exhaustion
} else {
- this.a(0.2F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionJumping ); // PaperSpigot - Configurable jumping exhaustion
}
}
@@ -1294,13 +1294,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
- this.a(0.015F * (float) i * 0.01F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionSwimming * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion
}
} else if (this.L()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.i, i);
- this.a(0.015F * (float) i * 0.01F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionSwimming * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion
}
} else if (this.h_()) {
if (d1 > 0.0D) {
@@ -1311,9 +1311,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (i > 0) {
this.a(StatisticList.h, i);
if (this.isSprinting()) {
- this.a(0.099999994F * (float) i * 0.01F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionSprinting * (float) i * 0.01F); // PaperSpigot - Configurable sprinting exhaustion
} else {
- this.a(0.01F * (float) i * 0.01F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionWalking * (float) i * 0.01F); // PaperSpigot - Configurable walking exhaustion
}
}
} else {
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index 4e91fe9..423a0c4 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.github.paperspigot.PaperSpigotWorldConfig; // PaperSpigot
+
public class FoodMetaData {
// CraftBukkit start - All made public
@@ -65,7 +67,7 @@ public class FoodMetaData {
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
- this.a(3.0F);
+ this.a( PaperSpigotWorldConfig.playerExhaustionRegeneration ); // PaperSpigot - Configurable regeneration exhaustion
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 554e74a..dec078a 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -124,4 +124,24 @@ public class PaperSpigotWorldConfig
fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", fishingMinTicks );
fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", fishingMaxTicks );
}
+
+ 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;
+ private void playerExhaustion()
+ {
+ 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