File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
src/main/java/com/provismet/CombatPlusCore/enchantments Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
package com .provismet .CombatPlusCore .enchantments ;
2
2
3
+ import org .jetbrains .annotations .Nullable ;
4
+
3
5
import com .provismet .CombatPlusCore .interfaces .CPCEnchantment ;
4
6
import com .provismet .CombatPlusCore .utility .CPCEnchantmentHelper ;
5
7
import com .provismet .CombatPlusCore .utility .CPCEnchantmentTargets ;
@@ -30,6 +32,24 @@ public boolean canAccept (Enchantment other) {
30
32
!(other instanceof SweepingEnchantment ) &&
31
33
!(other instanceof LuckEnchantment ) &&
32
34
!CPCEnchantmentHelper .isDamage (other ) &&
33
- !CPCEnchantmentHelper .isAdditionalDamage (other );
35
+ !CPCEnchantmentHelper .isAdditionalDamage (other ) &&
36
+ !(other instanceof OffHandEnchantment otherOffhand &&
37
+ otherOffhand .getGroup () != null &&
38
+ this .getGroup () != null &&
39
+ otherOffhand .getGroup () != this .getGroup ()
40
+ );
34
41
}
42
+
43
+ /**
44
+ * Returns the group name of this enchantment. Offhand enchantments that have a group cannot
45
+ * be mixed with offhand enchantments that belong to a different group.
46
+ *
47
+ * <p> This system exists because offhand enchantments may be designed to interact with each other (see the Dual Swords mod).
48
+ * The Offhand Enchantment class is intentionally miscellaneous by nature, so this library will offer a rudimentary grouping
49
+ * system instead of direct subclasses.
50
+ *
51
+ * @return A unique string denoting the group name of this enchantment, or null.
52
+ */
53
+ @ Nullable
54
+ protected abstract String getGroup ();
35
55
}
You can’t perform that action at this time.
0 commit comments