Player Exhaustion Multipliers

This commit is contained in:
gsand 2014-07-06 19:18:38 -05:00 committed by Zach Brown
parent a1c77b4f20
commit 64863c09c3
2 changed files with 137 additions and 3 deletions

View File

@ -1,11 +1,11 @@
From 9c171f8c9366c35ca2933948c57965fa3a6bd0ed Mon Sep 17 00:00:00 2001
From 49b4586b78701abab84fccae9f8d1a26176b3f13 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Thu, 3 Jul 2014 00:53:47 -0500
Subject: [PATCH] Configurable interaction limit restriction
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index baa89ef..d5f3b7b 100644
index 1221319..f8967f7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -59,6 +59,8 @@ import org.bukkit.inventory.InventoryView;
@ -17,7 +17,7 @@ index baa89ef..d5f3b7b 100644
public class PlayerConnection implements PacketPlayInListener {
private static final Logger c = LogManager.getLogger();
@@ -570,7 +572,7 @@ public class PlayerConnection implements PacketPlayInListener {
@@ -577,7 +579,7 @@ public class PlayerConnection implements PacketPlayInListener {
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
boolean throttled = false;

View File

@ -0,0 +1,134 @@
From e23cc5ffca45879a20c480fdb73f6079765f5246 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