Skip to content

Commit 0ec783f

Browse files
committed
Fix sword enchantment cracker in older versions
1 parent f556ba1 commit 0ec783f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/net/earthcomputer/clientcommands/util/SeedfindingUtil.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ public static boolean doesEnchantmentExist(Enchantment enchantment) {
6767
return false;
6868
}
6969
String name = id.getPath();
70-
return Enchantments.getFor(SeedfindingUtil.getMCVersion()).stream().anyMatch(ench -> ench.getName().equals(name));
70+
71+
// Hack: sweeping was renamed to sweeping_edge, do an inverse rename here.
72+
// This should no longer be necessary once enchantments are data-driven in 1.21
73+
if ("sweeping_edge".equals(name)) {
74+
name = "sweeping";
75+
}
76+
77+
String name_f = name;
78+
return Enchantments.getFor(SeedfindingUtil.getMCVersion()).stream().anyMatch(ench -> ench.getName().equals(name_f));
7179
}
7280

7381
public static MCVersion getMCVersion() {

0 commit comments

Comments
 (0)