From cffcda2bc7c2e78bbd65ad49a42b41a785b0bb07 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Sat, 15 Jun 2024 23:09:34 +0200 Subject: [PATCH] Configurable damage tick when blocking with shield (#10877) A long standing bug in spigot and its derivatives was the fact that players taking damage while blocking with a shield would not receive invulnerability, while they do in vanilla. This enabled the pvp technique of disabling a shield and immediately attacking again to knock a player into the air. While upstream fixed this and properly aligned itself with vanilla damage logic (in this specific case) changing such long standing behaviour has some downsides. To allow players used to this specific bug to still use it, this patch introduces a configuration option to re-introduce said bug. As there is no easy way to *only* re-add this bug, the option is found in the unsupported section as it may introduce other damage related disparity from vanilla. --- ...amage-tick-when-blocking-with-shield.patch | 19 +++++++++++++++++++ patches/server/Paper-config-files.patch | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 patches/server/Configurable-damage-tick-when-blocking-with-shield.patch diff --git a/patches/server/Configurable-damage-tick-when-blocking-with-shield.patch b/patches/server/Configurable-damage-tick-when-blocking-with-shield.patch new file mode 100644 index 0000000000..00116c4865 --- /dev/null +++ b/patches/server/Configurable-damage-tick-when-blocking-with-shield.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Bjarne Koll +Date: Thu, 13 Jun 2024 17:16:01 +0200 +Subject: [PATCH] Configurable damage tick when blocking with shield + + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { + CriteriaTriggers.PLAYER_HURT_ENTITY.trigger((ServerPlayer) damagesource.getEntity(), this, damagesource, originalDamage, f, true); // Paper - fix taken/dealt param order + } + +- return true; ++ return !io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.skipVanillaDamageTickWhenShieldBlocked; // Paper - this should always return true, however expose an unsupported setting to flip this to false to enable "shield stunning". + } else { + return true; // Paper - return false ONLY if event was cancelled + } diff --git a/patches/server/Paper-config-files.patch b/patches/server/Paper-config-files.patch index 89e638d572..73db1cb4dc 100644 --- a/patches/server/Paper-config-files.patch +++ b/patches/server/Paper-config-files.patch @@ -651,6 +651,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean performUsernameValidation = true; + @Comment("This setting controls if players should be able to create headless pistons.") + public boolean allowHeadlessPistons = false; ++ @Comment("This setting controls if the vanilla damage tick should be skipped if damage was blocked via a shield.") ++ public boolean skipVanillaDamageTickWhenShieldBlocked = false; + @Comment("This setting controls what compression format is used for region files.") + public CompressionFormat compressionFormat = CompressionFormat.ZLIB; +