Paper/patches/server/0206-Make-shield-blocking-delay-configurable.patch

71 lines
3.2 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 16 Jun 2018 01:18:16 -0500
Subject: [PATCH] Make shield blocking delay configurable
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 7a25d602a016c4113cf93f58fa5dfcb8613067fe..9b2f958b70eaf44d3686c5dafc29f81fa23a8979 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -404,4 +404,9 @@ public class PaperWorldConfig {
2021-06-11 14:02:28 +02:00
disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit);
log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled"));
}
+
+ public int shieldBlockingDelay = 5;
+ private void shieldBlockingDelay() {
+ shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5);
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2022-06-03 06:26:56 +02:00
index 2449cd753ec52b7e2d2213fcd3979d616a33c677..1610cf860b7f72a1ca8a1df69115d2f4bedc5d1b 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2022-03-01 06:43:03 +01:00
@@ -3658,12 +3658,24 @@ public abstract class LivingEntity extends Entity {
2021-06-11 14:02:28 +02:00
if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem();
- return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= 5;
+ return item.getUseAnimation(this.useItem) != UseAnim.BLOCK ? false : item.getUseDuration(this.useItem) - this.useItemRemaining >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
} else {
return false;
}
}
2021-06-12 21:30:37 +02:00
2021-06-11 14:02:28 +02:00
+ // Paper start
+ public int shieldBlockingDelay = level.paperConfig.shieldBlockingDelay;
+
+ public int getShieldBlockingDelay() {
+ return shieldBlockingDelay;
+ }
+
+ public void setShieldBlockingDelay(int shieldBlockingDelay) {
+ this.shieldBlockingDelay = shieldBlockingDelay;
+ }
+ // Paper end
2021-06-12 21:30:37 +02:00
+
public boolean isSuppressingSlidingDownLadder() {
return this.isShiftKeyDown();
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2021-11-23 16:04:41 +01:00
index 6455a81fea0de79173419587171b5ed025c30592..bbb7d6bcdc280236a583056cf9ccfc7b8de37706 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -739,5 +739,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2021-06-11 14:02:28 +02:00
public void setArrowsStuck(int arrows) {
getHandle().setArrowCount(arrows);
}
+
+ @Override
+ public int getShieldBlockingDelay() {
+ return getHandle().getShieldBlockingDelay();
+ }
+
+ @Override
+ public void setShieldBlockingDelay(int delay) {
+ getHandle().setShieldBlockingDelay(delay);
+ }
// Paper end
}