From cb0ed1c7236c9ef42fc00e62a9c7b21601510434 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Mon, 15 Jan 2024 20:48:04 +0800 Subject: [PATCH] Protection stacking (#29) --- ...005-Leaves-Server-Config-And-Command.patch | 7 ++++-- patches/server/0127-Protection-stacking.patch | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 patches/server/0127-Protection-stacking.patch diff --git a/patches/server/0005-Leaves-Server-Config-And-Command.patch b/patches/server/0005-Leaves-Server-Config-And-Command.patch index d655dfc3..0a7ef70d 100644 --- a/patches/server/0005-Leaves-Server-Config-And-Command.patch +++ b/patches/server/0005-Leaves-Server-Config-And-Command.patch @@ -78,10 +78,10 @@ index 01d907e3266095bb33d3a73dc56004fd79043943..06c00aa070334deeae96524b35ff1295 .withRequiredArg() diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java new file mode 100644 -index 0000000000000000000000000000000000000000..82376b6a310ccdc9d813e20482ea7841c7ea7cf1 +index 0000000000000000000000000000000000000000..837ab6d67fc563042364985ecd5c44cf231e5804 --- /dev/null +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -0,0 +1,864 @@ +@@ -0,0 +1,867 @@ +package top.leavesmc.leaves; + +import com.destroystokyo.paper.util.SneakyThrow; @@ -336,6 +336,9 @@ index 0000000000000000000000000000000000000000..82376b6a310ccdc9d813e20482ea7841 + } + } + ++ @GlobalConfig(name = "protection-stacking", category = {"modify", "minecraft-old"}) ++ public static boolean protectionStacking = false; ++ + // Leaves end - modify - minecraft-old + + // Leaves start - modify - elytra-aeronautics diff --git a/patches/server/0127-Protection-stacking.patch b/patches/server/0127-Protection-stacking.patch new file mode 100644 index 00000000..c5a3054b --- /dev/null +++ b/patches/server/0127-Protection-stacking.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Mon, 15 Jan 2024 20:47:05 +0800 +Subject: [PATCH] Protection stacking + + +diff --git a/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java +index ba8bd0df934f28c5dae6fd8a85ec0b73f6d3aa31..cdb7dea2dc9fcafcdb7eaf8750a7c637bffc00e9 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java +@@ -48,6 +48,11 @@ public class ProtectionEnchantment extends Enchantment { + + @Override + public boolean checkCompatibility(Enchantment other) { ++ // Leaves start - protection stacking ++ if (top.leavesmc.leaves.LeavesConfig.protectionStacking) { ++ return super.checkCompatibility(other); ++ } ++ // Leaves end - protection stacking + if (other instanceof ProtectionEnchantment protectionEnchantment) { + if (this.type == protectionEnchantment.type) { + return false;