Improved Control of Enchantment.canApplyTogether() in Mod Enchantments, allowing both enchantments to determine if they can apply together. Closes #1434
This commit is contained in:
parent
35fac1f691
commit
4cc278a125
3 changed files with 35 additions and 3 deletions
|
@ -0,0 +1,11 @@
|
|||
--- ../src-base/minecraft/net/minecraft/command/CommandEnchant.java
|
||||
+++ ../src-work/minecraft/net/minecraft/command/CommandEnchant.java
|
||||
@@ -76,7 +76,7 @@
|
||||
{
|
||||
Enchantment enchantment1 = Enchantment.field_77331_b[short1];
|
||||
|
||||
- if (!enchantment1.func_77326_a(enchantment))
|
||||
+ if (!enchantment1.func_77326_a(enchantment) || !enchantment.func_77326_a(enchantment1)) //Forge BugFix: Let Both enchantments veto being together
|
||||
{
|
||||
throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment.func_77316_c(j), enchantment1.func_77316_c(nbttaglist.func_150305_b(k).func_74765_d("lvl"))});
|
||||
}
|
|
@ -18,7 +18,18 @@
|
|||
|
||||
if (j <= 0)
|
||||
{
|
||||
@@ -435,7 +435,8 @@
|
||||
@@ -393,7 +393,9 @@
|
||||
{
|
||||
EnchantmentData enchantmentdata1 = (EnchantmentData)iterator1.next();
|
||||
|
||||
- if (enchantmentdata1.field_76302_b.func_77326_a(Enchantment.field_77331_b[integer.intValue()]))
|
||||
+ Enchantment e1 = enchantmentdata1.field_76302_b;
|
||||
+ Enchantment e2 = Enchantment.field_77331_b[integer.intValue()];
|
||||
+ if (e1.func_77326_a(e2) && e2.func_77326_a(e1)) //Forge BugFix: Let Both enchantments veto being together
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -435,7 +437,8 @@
|
||||
{
|
||||
Enchantment enchantment = aenchantment[k];
|
||||
|
||||
|
|
|
@ -34,7 +34,17 @@
|
|||
flag = itemstack2.func_77973_b() == Items.field_151134_bR && Items.field_151134_bR.func_92110_g(itemstack2).func_74745_c() > 0;
|
||||
|
||||
if (itemstack1.func_77984_f() && itemstack1.func_77973_b().func_82789_a(itemstack, itemstack2))
|
||||
@@ -373,6 +377,8 @@
|
||||
@@ -258,7 +262,8 @@
|
||||
{
|
||||
int j2 = ((Integer)iterator.next()).intValue();
|
||||
|
||||
- if (j2 != i1 && !enchantment.func_77326_a(Enchantment.field_77331_b[j2]))
|
||||
+ Enchantment e2 = Enchantment.field_77331_b[j2];
|
||||
+ if (j2 != i1 && !(enchantment.func_77326_a(e2) && e2.func_77326_a(enchantment))) //Forge BugFix: Let Both enchantments veto being together
|
||||
{
|
||||
flag1 = false;
|
||||
i += i2;
|
||||
@@ -373,6 +378,8 @@
|
||||
k2 = Math.max(1, k2 / 2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue