Addition: Added isAllowedOnBooks hook to Enchantments Closes #589
This commit is contained in:
parent
7ad79b42bc
commit
f65f042910
2 changed files with 12 additions and 2 deletions
|
@ -10,7 +10,7 @@
|
|||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -207,6 +210,27 @@
|
||||
@@ -207,6 +210,36 @@
|
||||
return this.type.canEnchantItem(par1ItemStack.getItem());
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,15 @@
|
|||
+ {
|
||||
+ ObjectArrays.concat(enchantmentsBookList, enchantment);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Is this enchantment allowed to be enchanted on books via Enchantment Table
|
||||
+ * @return false to disable the vanilla feature
|
||||
+ */
|
||||
+ public boolean isAllowedOnBooks()
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
static
|
||||
{
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
--- ../src_base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
|
||||
+++ ../src_work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
|
||||
@@ -463,7 +463,7 @@
|
||||
@@ -463,7 +463,8 @@
|
||||
{
|
||||
Enchantment enchantment = aenchantment[k];
|
||||
|
||||
- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag))
|
||||
+ flag = (par1ItemStack.itemID == Item.book.itemID) && enchantment.isAllowedOnBooks();
|
||||
+ if (enchantment != null && (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag))
|
||||
{
|
||||
for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l)
|
||||
|
|
Loading…
Reference in a new issue