Skip to content

Commit cb0ed1c

Browse files
s-yh-chinaLumine1909
authored andcommitted
Protection stacking (LeavesMC#29)
1 parent fd6ee38 commit cb0ed1c

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

patches/server/0005-Leaves-Server-Config-And-Command.patch

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ index 01d907e3266095bb33d3a73dc56004fd79043943..06c00aa070334deeae96524b35ff1295
7878
.withRequiredArg()
7979
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
8080
new file mode 100644
81-
index 0000000000000000000000000000000000000000..82376b6a310ccdc9d813e20482ea7841c7ea7cf1
81+
index 0000000000000000000000000000000000000000..837ab6d67fc563042364985ecd5c44cf231e5804
8282
--- /dev/null
8383
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
84-
@@ -0,0 +1,864 @@
84+
@@ -0,0 +1,867 @@
8585
+package top.leavesmc.leaves;
8686
+
8787
+import com.destroystokyo.paper.util.SneakyThrow;
@@ -336,6 +336,9 @@ index 0000000000000000000000000000000000000000..82376b6a310ccdc9d813e20482ea7841
336336
+ }
337337
+ }
338338
+
339+
+ @GlobalConfig(name = "protection-stacking", category = {"modify", "minecraft-old"})
340+
+ public static boolean protectionStacking = false;
341+
+
339342
+ // Leaves end - modify - minecraft-old
340343
+
341344
+ // Leaves start - modify - elytra-aeronautics
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: violetc <[email protected]>
3+
Date: Mon, 15 Jan 2024 20:47:05 +0800
4+
Subject: [PATCH] Protection stacking
5+
6+
7+
diff --git a/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java
8+
index ba8bd0df934f28c5dae6fd8a85ec0b73f6d3aa31..cdb7dea2dc9fcafcdb7eaf8750a7c637bffc00e9 100644
9+
--- a/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java
10+
+++ b/src/main/java/net/minecraft/world/item/enchantment/ProtectionEnchantment.java
11+
@@ -48,6 +48,11 @@ public class ProtectionEnchantment extends Enchantment {
12+
13+
@Override
14+
public boolean checkCompatibility(Enchantment other) {
15+
+ // Leaves start - protection stacking
16+
+ if (top.leavesmc.leaves.LeavesConfig.protectionStacking) {
17+
+ return super.checkCompatibility(other);
18+
+ }
19+
+ // Leaves end - protection stacking
20+
if (other instanceof ProtectionEnchantment protectionEnchantment) {
21+
if (this.type == protectionEnchantment.type) {
22+
return false;

0 commit comments

Comments
 (0)