mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-04 01:39:54 +01:00
70 lines
3.3 KiB
Diff
70 lines
3.3 KiB
Diff
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 e8e1e7dafaf1c105b2f58cf3e118e3d665dc50ec..3e4bd1d6718d3ad2498fe9bd72eaac45044ecb77 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -369,4 +369,9 @@ public class PaperWorldConfig {
|
|
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/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
index 1dcdf9e328670b42d656e8ab65cb3da8a2312fe6..9f6f6ac15688a1010d466e6f0cc3ac5b8297eb21 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
@@ -3311,7 +3311,7 @@ public abstract class EntityLiving extends Entity {
|
|
if (this.isHandRaised() && !this.activeItem.isEmpty()) {
|
|
Item item = this.activeItem.getItem();
|
|
|
|
- return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bd >= 5;
|
|
+ return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bd >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay
|
|
} else {
|
|
return false;
|
|
}
|
|
@@ -3567,4 +3567,15 @@ public abstract class EntityLiving extends Entity {
|
|
public void broadcastItemBreak(EnumHand enumhand) {
|
|
this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND);
|
|
}
|
|
+ // Paper start
|
|
+ public int shieldBlockingDelay = world.paperConfig.shieldBlockingDelay;
|
|
+
|
|
+ public int getShieldBlockingDelay() {
|
|
+ return shieldBlockingDelay;
|
|
+ }
|
|
+
|
|
+ public void setShieldBlockingDelay(int shieldBlockingDelay) {
|
|
+ this.shieldBlockingDelay = shieldBlockingDelay;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index c43c300963bae9bca6ab9c9389dd53e42318715c..2d1c54eed8fa6885837d63014ff1f4b33dd35bd7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -711,5 +711,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
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
|
|
}
|