46 lines
1.5 KiB
Diff
46 lines
1.5 KiB
Diff
--- a/net/minecraft/enchantment/Enchantment.java
|
|
+++ b/net/minecraft/enchantment/Enchantment.java
|
|
@@ -18,7 +18,7 @@
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
|
|
-public abstract class Enchantment {
|
|
+public abstract class Enchantment extends net.minecraftforge.registries.ForgeRegistryEntry<Enchantment> {
|
|
private final EquipmentSlotType[] field_185263_a;
|
|
private final Enchantment.Rarity field_77333_a;
|
|
public final EnchantmentType field_77351_y;
|
|
@@ -114,7 +114,7 @@
|
|
}
|
|
|
|
public boolean func_92089_a(ItemStack p_92089_1_) {
|
|
- return this.field_77351_y.func_77557_a(p_92089_1_.func_77973_b());
|
|
+ return canApplyAtEnchantingTable(p_92089_1_);
|
|
}
|
|
|
|
public void func_151368_a(LivingEntity p_151368_1_, Entity p_151368_2_, int p_151368_3_) {
|
|
@@ -139,6 +139,24 @@
|
|
return true;
|
|
}
|
|
|
|
+ /**
|
|
+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
|
|
+ * applies for <i>all possible</i> enchantments.
|
|
+ * @param stack
|
|
+ * @return
|
|
+ */
|
|
+ public boolean canApplyAtEnchantingTable(ItemStack stack) {
|
|
+ return stack.canApplyAtEnchantingTable(this);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Is this enchantment allowed to be enchanted on books via Enchantment Table
|
|
+ * @return false to disable the vanilla feature
|
|
+ */
|
|
+ public boolean isAllowedOnBooks() {
|
|
+ return true;
|
|
+ }
|
|
+
|
|
public static enum Rarity {
|
|
COMMON(10),
|
|
UNCOMMON(5),
|