Allow items to decide if they can or cannot have book enchantments applied
This commit is contained in:
parent
d6b70f7b66
commit
f6a2bf28fe
2 changed files with 39 additions and 5 deletions
patches/minecraft/net/minecraft
|
@ -0,0 +1,22 @@
|
|||
--- ../src_base/minecraft/net/minecraft/inventory/ContainerRepair.java
|
||||
+++ ../src_work/minecraft/net/minecraft/inventory/ContainerRepair.java
|
||||
@@ -305,6 +305,11 @@
|
||||
k = Math.max(1, k / 2);
|
||||
}
|
||||
|
||||
+ if (flag && itemstack1!=null && !Item.itemsList[itemstack1.itemID].isBookEnchantable(itemstack1,itemstack2))
|
||||
+ {
|
||||
+ itemstack1 = null;
|
||||
+ }
|
||||
+
|
||||
this.maximumCost = k + i;
|
||||
|
||||
if (i <= 0)
|
||||
@@ -322,6 +327,7 @@
|
||||
{
|
||||
itemstack1 = null;
|
||||
}
|
||||
+
|
||||
|
||||
if (itemstack1 != null)
|
||||
{
|
|
@ -47,7 +47,7 @@
|
|||
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
|
||||
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
|
||||
}
|
||||
@@ -720,4 +730,324 @@
|
||||
@@ -720,4 +730,336 @@
|
||||
{
|
||||
StatList.initStats();
|
||||
}
|
||||
|
@ -329,7 +329,7 @@
|
|||
+
|
||||
+ /**
|
||||
+ * Determines if the specific ItemStack can be placed in the specified armor slot.
|
||||
+ *
|
||||
+ *
|
||||
+ * @param stack The ItemStack
|
||||
+ * @param armorType Armor slot ID: 0: Helmet, 1: Chest, 2: Legs, 3: Boots
|
||||
+ * @return True if the given ItemStack can be inserted in the slot
|
||||
|
@ -348,10 +348,10 @@
|
|||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * ItemStack sensitive version of isPotionIngredient
|
||||
+ *
|
||||
+ *
|
||||
+ * @param stack The item stack
|
||||
+ * @return True if this stack can be used as a potion ingredient
|
||||
+ */
|
||||
|
@ -362,7 +362,7 @@
|
|||
+
|
||||
+ /**
|
||||
+ * ItemStack sensitive version of getPotionEffect
|
||||
+ *
|
||||
+ *
|
||||
+ * @param stack The item stack
|
||||
+ * @return A string containing the bit manipulation to apply the the potion.
|
||||
+ */
|
||||
|
@ -370,5 +370,17 @@
|
|||
+ {
|
||||
+ return getPotionEffect();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Allow or forbid the specific book/item combination as an anvil enchant
|
||||
+ *
|
||||
+ * @param itemstack1 The item
|
||||
+ * @param itemstack2 The book
|
||||
+ * @return if the enchantment is allowed
|
||||
+ */
|
||||
+ public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue