3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/patches/server/0198-Make-shield-blocking-delay-configurable.patch

57 Zeilen
2.6 KiB
Diff

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/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
2024-10-27 18:11:15 +01:00
index 84e11e2c62e643f959f1a570a27f6ad07df165d4..08a2fbca50e26938e46e49dae7b101cfc375b02e 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
2024-10-27 18:11:15 +01:00
@@ -4101,12 +4101,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
2021-06-11 14:02:28 +02:00
if (this.isUsingItem() && !this.useItem.isEmpty()) {
Item item = this.useItem.getItem();
2024-10-23 00:02:50 +02:00
- return item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK ? null : (item.getUseDuration(this.useItem, this) - this.useItemRemaining < 5 ? null : this.useItem);
+ return item.getUseAnimation(this.useItem) != ItemUseAnimation.BLOCK ? null : (item.getUseDuration(this.useItem, this) - this.useItemRemaining < getShieldBlockingDelay() ? null : this.useItem); // Paper - Make shield blocking delay configurable
2021-06-11 14:02:28 +02:00
} else {
2024-10-23 00:02:50 +02:00
return null;
2021-06-11 14:02:28 +02:00
}
}
2021-06-12 21:30:37 +02:00
+ // Paper start - Make shield blocking delay configurable
2023-06-07 23:35:19 +02:00
+ public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay;
2021-06-11 14:02:28 +02:00
+
+ public int getShieldBlockingDelay() {
+ return shieldBlockingDelay;
+ }
+
+ public void setShieldBlockingDelay(int shieldBlockingDelay) {
+ this.shieldBlockingDelay = shieldBlockingDelay;
+ }
+ // Paper end - Make shield blocking delay configurable
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
2024-10-23 00:02:50 +02:00
index 452fe788152f7c38ab4b6c627e3ba37da3d9b9d9..e5186fbd4030d7b39443090b711e855dcbc39426 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
2024-10-23 00:02:50 +02:00
@@ -873,5 +873,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public void setArrowsStuck(final int arrows) {
this.getHandle().setArrowCount(arrows);
2021-06-11 14:02:28 +02:00
}
+
+ @Override
+ public int getShieldBlockingDelay() {
+ return getHandle().getShieldBlockingDelay();
+ }
+
+ @Override
+ public void setShieldBlockingDelay(int delay) {
+ getHandle().setShieldBlockingDelay(delay);
+ }
// Paper end
}