From 7df472527f94ee518faa038bdd0168edb6aebada 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. --- patches/server/0005-Paper-config-files.patch | 6 ++++-- .../0747-Configurable-chat-thread-limit.patch | 4 ++-- ...ing-message-for-initial-server-start.patch | 2 +- ...amage-tick-when-blocking-with-shield.patch | 19 +++++++++++++++++++ ...hunk-System-Starlight-from-Moonrise.patch} | 4 ++-- ...> 0992-Rewrite-dataconverter-system.patch} | 0 ...93-disable-forced-empty-world-ticks.patch} | 0 ...dBounds-and-getBlockState-for-inlin.patch} | 0 ...tem-frames-performance-and-bug-fixe.patch} | 0 ...ing-for-EntityLiving-hasLineOfSight.patch} | 2 +- ...Manager-and-add-advanced-packet-sup.patch} | 0 ...98-Allow-Saving-of-Oversized-Chunks.patch} | 0 ...999-Flat-bedrock-generator-settings.patch} | 0 ...=> 1000-Entity-Activation-Range-2.0.patch} | 0 ...1001-Optional-per-player-mob-spawns.patch} | 0 ...1-Anti-Xray.patch => 1002-Anti-Xray.patch} | 0 ...-Eigencraft-redstone-implementation.patch} | 0 ...ate-Current-redstone-implementation.patch} | 0 ...g-PreCreatureSpawnEvent-with-per-pl.patch} | 0 ...city-compression-and-cipher-natives.patch} | 0 ...alSelector-Goal.Flag-Set-operations.patch} | 0 ...pers.patch => 1008-Optimize-Hoppers.patch} | 0 ...> 1009-Optimize-Voxel-Shape-Merging.patch} | 0 ...Optimize-Bit-Operations-by-inlining.patch} | 0 ...> 1011-Remove-streams-from-hot-code.patch} | 0 ...er-Remove-Streams-Optimized-collect.patch} | 0 ...ementation-for-blockstate-state-loo.patch} | 0 ...-type-tags-suggestions-in-selectors.patch} | 0 ...-Oversized-block-entities-in-chunks.patch} | 0 ...> 1016-API-for-checking-sent-chunks.patch} | 0 30 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 patches/server/0990-Configurable-damage-tick-when-blocking-with-shield.patch rename patches/server/{0990-Chunk-System-Starlight-from-Moonrise.patch => 0991-Chunk-System-Starlight-from-Moonrise.patch} (99%) rename patches/server/{0991-Rewrite-dataconverter-system.patch => 0992-Rewrite-dataconverter-system.patch} (100%) rename patches/server/{0992-disable-forced-empty-world-ticks.patch => 0993-disable-forced-empty-world-ticks.patch} (100%) rename patches/server/{0993-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch => 0994-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch} (100%) rename patches/server/{0994-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch => 0995-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch} (100%) rename patches/server/{0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch => 0996-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch} (98%) rename patches/server/{0996-Optimize-Network-Manager-and-add-advanced-packet-sup.patch => 0997-Optimize-Network-Manager-and-add-advanced-packet-sup.patch} (100%) rename patches/server/{0997-Allow-Saving-of-Oversized-Chunks.patch => 0998-Allow-Saving-of-Oversized-Chunks.patch} (100%) rename patches/server/{0998-Flat-bedrock-generator-settings.patch => 0999-Flat-bedrock-generator-settings.patch} (100%) rename patches/server/{0999-Entity-Activation-Range-2.0.patch => 1000-Entity-Activation-Range-2.0.patch} (100%) rename patches/server/{1000-Optional-per-player-mob-spawns.patch => 1001-Optional-per-player-mob-spawns.patch} (100%) rename patches/server/{1001-Anti-Xray.patch => 1002-Anti-Xray.patch} (100%) rename patches/server/{1002-Eigencraft-redstone-implementation.patch => 1003-Eigencraft-redstone-implementation.patch} (100%) rename patches/server/{1003-Add-Alternate-Current-redstone-implementation.patch => 1004-Add-Alternate-Current-redstone-implementation.patch} (100%) rename patches/server/{1004-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch => 1005-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch} (100%) rename patches/server/{1005-Use-Velocity-compression-and-cipher-natives.patch => 1006-Use-Velocity-compression-and-cipher-natives.patch} (100%) rename patches/server/{1006-Optimize-GoalSelector-Goal.Flag-Set-operations.patch => 1007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch} (100%) rename patches/server/{1007-Optimize-Hoppers.patch => 1008-Optimize-Hoppers.patch} (100%) rename patches/server/{1008-Optimize-Voxel-Shape-Merging.patch => 1009-Optimize-Voxel-Shape-Merging.patch} (100%) rename patches/server/{1009-Optimize-Bit-Operations-by-inlining.patch => 1010-Optimize-Bit-Operations-by-inlining.patch} (100%) rename patches/server/{1010-Remove-streams-from-hot-code.patch => 1011-Remove-streams-from-hot-code.patch} (100%) rename patches/server/{1011-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch => 1012-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch} (100%) rename patches/server/{1012-Custom-table-implementation-for-blockstate-state-loo.patch => 1013-Custom-table-implementation-for-blockstate-state-loo.patch} (100%) rename patches/server/{1013-Fix-entity-type-tags-suggestions-in-selectors.patch => 1014-Fix-entity-type-tags-suggestions-in-selectors.patch} (100%) rename patches/server/{1014-Handle-Oversized-block-entities-in-chunks.patch => 1015-Handle-Oversized-block-entities-in-chunks.patch} (100%) rename patches/server/{1015-API-for-checking-sent-chunks.patch => 1016-API-for-checking-sent-chunks.patch} (100%) diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index e5631ad5cb..f33d4cb93a 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -487,10 +487,10 @@ index 0000000000000000000000000000000000000000..d9502ba028a96f9cc846f9ed428bd806 +} diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..892351c3b6397b3cde6a31a6594c0e16bbe1252b +index 0000000000000000000000000000000000000000..7045040681e639f36fefcf2735f67367d5e3cbc4 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -0,0 +1,311 @@ +@@ -0,0 +1,313 @@ +package io.papermc.paper.configuration; + +import co.aikar.timings.MinecraftTimings; @@ -651,6 +651,8 @@ index 0000000000000000000000000000000000000000..892351c3b6397b3cde6a31a6594c0e16 + 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; + diff --git a/patches/server/0747-Configurable-chat-thread-limit.patch b/patches/server/0747-Configurable-chat-thread-limit.patch index fa5e60fd33..62a41e3361 100644 --- a/patches/server/0747-Configurable-chat-thread-limit.patch +++ b/patches/server/0747-Configurable-chat-thread-limit.patch @@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or who just wanna ensure that this won't grow over a specific size if chat gets stupidly active diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 892351c3b6397b3cde6a31a6594c0e16bbe1252b..ab5089781b8866cd6ad1b9570634ba84d936cfe7 100644 +index 7045040681e639f36fefcf2735f67367d5e3cbc4..cc847dce0116b8260790b890b1d5452c280e186c 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -285,7 +285,18 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -287,7 +287,18 @@ public class GlobalConfiguration extends ConfigurationPart { @PostProcess private void postProcess() { diff --git a/patches/server/0946-Add-onboarding-message-for-initial-server-start.patch b/patches/server/0946-Add-onboarding-message-for-initial-server-start.patch index ca3fd81590..89e4195a68 100644 --- a/patches/server/0946-Add-onboarding-message-for-initial-server-start.patch +++ b/patches/server/0946-Add-onboarding-message-for-initial-server-start.patch @@ -17,7 +17,7 @@ index d9502ba028a96f9cc846f9ed428bd8066b857ca3..87e5f614ba988547a827486740db217e node = loader.load(); this.verifyGlobalConfigVersion(node); diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index ab5089781b8866cd6ad1b9570634ba84d936cfe7..4de88f74182bb596c6b5ad0351cc0dacefd0ce96 100644 +index cc847dce0116b8260790b890b1d5452c280e186c..2a5453707bc172d8d0efe3f11959cb0b5f830984 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/0990-Configurable-damage-tick-when-blocking-with-shield.patch b/patches/server/0990-Configurable-damage-tick-when-blocking-with-shield.patch new file mode 100644 index 0000000000..8c0e7e79e6 --- /dev/null +++ b/patches/server/0990-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 7a6c8a64bd119fd1f2fc245f84cbb332ecd937e3..45e5f14c3ad7cf25e11baa1554eb5fabac41ebe2 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -2380,7 +2380,7 @@ 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/0990-Chunk-System-Starlight-from-Moonrise.patch b/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch similarity index 99% rename from patches/server/0990-Chunk-System-Starlight-from-Moonrise.patch rename to patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch index 9be7b6a3fc..a6b6e89827 100644 --- a/patches/server/0990-Chunk-System-Starlight-from-Moonrise.patch +++ b/patches/server/0991-Chunk-System-Starlight-from-Moonrise.patch @@ -22118,7 +22118,7 @@ index 0d0cb3e63acd5156b6f9d6d78cc949b0af36a77b..dd1649abe57d7191c15a9b2862d5fd11 private ChunkSystem() { diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 4de88f74182bb596c6b5ad0351cc0dacefd0ce96..b4fa4259f66e449e754a70a7a99b9e68d9eb5016 100644 +index 2a5453707bc172d8d0efe3f11959cb0b5f830984..b8499c1cea97a1a88a53053bc7da132f2fd3928d 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -29,6 +29,45 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -22189,7 +22189,7 @@ index 4de88f74182bb596c6b5ad0351cc0dacefd0ce96..b4fa4259f66e449e754a70a7a99b9e68 public UnsupportedSettings unsupportedSettings; public class UnsupportedSettings extends ConfigurationPart { -@@ -201,7 +225,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -203,7 +227,7 @@ public class GlobalConfiguration extends ConfigurationPart { @PostProcess private void postProcess() { diff --git a/patches/server/0991-Rewrite-dataconverter-system.patch b/patches/server/0992-Rewrite-dataconverter-system.patch similarity index 100% rename from patches/server/0991-Rewrite-dataconverter-system.patch rename to patches/server/0992-Rewrite-dataconverter-system.patch diff --git a/patches/server/0992-disable-forced-empty-world-ticks.patch b/patches/server/0993-disable-forced-empty-world-ticks.patch similarity index 100% rename from patches/server/0992-disable-forced-empty-world-ticks.patch rename to patches/server/0993-disable-forced-empty-world-ticks.patch diff --git a/patches/server/0993-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0994-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch similarity index 100% rename from patches/server/0993-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch rename to patches/server/0994-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch diff --git a/patches/server/0994-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/patches/server/0995-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch similarity index 100% rename from patches/server/0994-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch rename to patches/server/0995-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch diff --git a/patches/server/0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/server/0996-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch similarity index 98% rename from patches/server/0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch rename to patches/server/0996-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch index 75589c401e..52c1df5a4d 100644 --- a/patches/server/0995-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch +++ b/patches/server/0996-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch @@ -26,7 +26,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7a6c8a64bd119fd1f2fc245f84cbb332ecd937e3..f35c9b1ee4bb99a4fad269b5f0cc46b8a1f3adfb 100644 +index 45e5f14c3ad7cf25e11baa1554eb5fabac41ebe2..25a7dfddb44a11f6e20c459141a61270c0c12d4c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3743,7 +3743,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0996-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/patches/server/0997-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 100% rename from patches/server/0996-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to patches/server/0997-Optimize-Network-Manager-and-add-advanced-packet-sup.patch diff --git a/patches/server/0997-Allow-Saving-of-Oversized-Chunks.patch b/patches/server/0998-Allow-Saving-of-Oversized-Chunks.patch similarity index 100% rename from patches/server/0997-Allow-Saving-of-Oversized-Chunks.patch rename to patches/server/0998-Allow-Saving-of-Oversized-Chunks.patch diff --git a/patches/server/0998-Flat-bedrock-generator-settings.patch b/patches/server/0999-Flat-bedrock-generator-settings.patch similarity index 100% rename from patches/server/0998-Flat-bedrock-generator-settings.patch rename to patches/server/0999-Flat-bedrock-generator-settings.patch diff --git a/patches/server/0999-Entity-Activation-Range-2.0.patch b/patches/server/1000-Entity-Activation-Range-2.0.patch similarity index 100% rename from patches/server/0999-Entity-Activation-Range-2.0.patch rename to patches/server/1000-Entity-Activation-Range-2.0.patch diff --git a/patches/server/1000-Optional-per-player-mob-spawns.patch b/patches/server/1001-Optional-per-player-mob-spawns.patch similarity index 100% rename from patches/server/1000-Optional-per-player-mob-spawns.patch rename to patches/server/1001-Optional-per-player-mob-spawns.patch diff --git a/patches/server/1001-Anti-Xray.patch b/patches/server/1002-Anti-Xray.patch similarity index 100% rename from patches/server/1001-Anti-Xray.patch rename to patches/server/1002-Anti-Xray.patch diff --git a/patches/server/1002-Eigencraft-redstone-implementation.patch b/patches/server/1003-Eigencraft-redstone-implementation.patch similarity index 100% rename from patches/server/1002-Eigencraft-redstone-implementation.patch rename to patches/server/1003-Eigencraft-redstone-implementation.patch diff --git a/patches/server/1003-Add-Alternate-Current-redstone-implementation.patch b/patches/server/1004-Add-Alternate-Current-redstone-implementation.patch similarity index 100% rename from patches/server/1003-Add-Alternate-Current-redstone-implementation.patch rename to patches/server/1004-Add-Alternate-Current-redstone-implementation.patch diff --git a/patches/server/1004-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/1005-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch similarity index 100% rename from patches/server/1004-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch rename to patches/server/1005-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch diff --git a/patches/server/1005-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/1006-Use-Velocity-compression-and-cipher-natives.patch similarity index 100% rename from patches/server/1005-Use-Velocity-compression-and-cipher-natives.patch rename to patches/server/1006-Use-Velocity-compression-and-cipher-natives.patch diff --git a/patches/server/1006-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/1007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch similarity index 100% rename from patches/server/1006-Optimize-GoalSelector-Goal.Flag-Set-operations.patch rename to patches/server/1007-Optimize-GoalSelector-Goal.Flag-Set-operations.patch diff --git a/patches/server/1007-Optimize-Hoppers.patch b/patches/server/1008-Optimize-Hoppers.patch similarity index 100% rename from patches/server/1007-Optimize-Hoppers.patch rename to patches/server/1008-Optimize-Hoppers.patch diff --git a/patches/server/1008-Optimize-Voxel-Shape-Merging.patch b/patches/server/1009-Optimize-Voxel-Shape-Merging.patch similarity index 100% rename from patches/server/1008-Optimize-Voxel-Shape-Merging.patch rename to patches/server/1009-Optimize-Voxel-Shape-Merging.patch diff --git a/patches/server/1009-Optimize-Bit-Operations-by-inlining.patch b/patches/server/1010-Optimize-Bit-Operations-by-inlining.patch similarity index 100% rename from patches/server/1009-Optimize-Bit-Operations-by-inlining.patch rename to patches/server/1010-Optimize-Bit-Operations-by-inlining.patch diff --git a/patches/server/1010-Remove-streams-from-hot-code.patch b/patches/server/1011-Remove-streams-from-hot-code.patch similarity index 100% rename from patches/server/1010-Remove-streams-from-hot-code.patch rename to patches/server/1011-Remove-streams-from-hot-code.patch diff --git a/patches/server/1011-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/1012-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch similarity index 100% rename from patches/server/1011-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch rename to patches/server/1012-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch diff --git a/patches/server/1012-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/1013-Custom-table-implementation-for-blockstate-state-loo.patch similarity index 100% rename from patches/server/1012-Custom-table-implementation-for-blockstate-state-loo.patch rename to patches/server/1013-Custom-table-implementation-for-blockstate-state-loo.patch diff --git a/patches/server/1013-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/1014-Fix-entity-type-tags-suggestions-in-selectors.patch similarity index 100% rename from patches/server/1013-Fix-entity-type-tags-suggestions-in-selectors.patch rename to patches/server/1014-Fix-entity-type-tags-suggestions-in-selectors.patch diff --git a/patches/server/1014-Handle-Oversized-block-entities-in-chunks.patch b/patches/server/1015-Handle-Oversized-block-entities-in-chunks.patch similarity index 100% rename from patches/server/1014-Handle-Oversized-block-entities-in-chunks.patch rename to patches/server/1015-Handle-Oversized-block-entities-in-chunks.patch diff --git a/patches/server/1015-API-for-checking-sent-chunks.patch b/patches/server/1016-API-for-checking-sent-chunks.patch similarity index 100% rename from patches/server/1015-API-for-checking-sent-chunks.patch rename to patches/server/1016-API-for-checking-sent-chunks.patch