Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
70 Zeilen
3.3 KiB
Diff
70 Zeilen
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 8a43a85a728c15dbc0fdd2fc8dc5dfff9a589358..d4ffff5ecb24af8439e5bfaa02e8136a10fdde90 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
|
|
}
|