Config to allow unsafe enchants

This commit is contained in:
Encode42
2025-01-11 18:07:22 -08:00
committed by granny
parent 0e04be6f1b
commit bb95be9955
5 changed files with 102 additions and 142 deletions

View File

@@ -27,3 +27,16 @@
public int getDamageValue() {
return Mth.clamp(this.getOrDefault(DataComponents.DAMAGE, Integer.valueOf(0)), 0, this.getMaxDamage());
}
@@ -1232,6 +_,12 @@
public boolean isEnchanted() {
return !this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY).isEmpty();
}
+
+ // Purpur start - Config to allow unsafe enchants
+ public boolean hasEnchantment(Holder<Enchantment> enchantment) {
+ return this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY).getLevel(enchantment) > 0;
+ }
+ // Purpur end - Config to allow unsafe enchants
public ItemEnchantments getEnchantments() {
return this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY);