Skip to content

Commit

Permalink
Protection stacking (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jan 15, 2024
1 parent 02d6b82 commit bc6733b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
7 changes: 5 additions & 2 deletions patches/server/0005-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions patches/server/0127-Protection-stacking.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <[email protected]>
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;

0 comments on commit bc6733b

Please sign in to comment.