示例#1
0
 public void #FIELD_CONTAINER_5#(EntityHuman entityhuman)
 {
     for(int i = 0; i < VAnvil.#FIELD_CONTAINERANVIL_1#(this).getSize(); ++i)
     {
         ItemStack itemstack = VAnvil.#FIELD_CONTAINERANVIL_1#(this).splitWithoutUpdate(i);
         if(itemstack != null)
         {
             entityhuman.drop(itemstack);
         }
     }
 }
示例#2
0
 public void #FIELD_CONTAINER_6#(IInventory iinventory)
 {
     super.#FIELD_CONTAINER_6#(iinventory);
     if(iinventory == VAnvil.#FIELD_CONTAINERANVIL_1#(this))
     {
         #FIELD_CONTAINERANVIL_4#();
     }
 }
示例#3
0
 public void #FIELD_CONTAINERANVIL_4#()
 {
     ItemStack itemstack = VAnvil.#FIELD_CONTAINERANVIL_1#(this).getItem(0);
     #FIELD_CONTAINERANVIL_5# = 0;
     int i = 0;
     byte b0 = 0;
     int j = 0;
     if(itemstack == null)
     {
         getInv("#FIELD_CONTAINERANVIL_2#").setItem(0, null);
         #FIELD_CONTAINERANVIL_5# = 0;
     }
     else
     {
         ItemStack itemstack1 = itemstack.cloneItemStack();
         ItemStack itemstack2 = VAnvil.#FIELD_CONTAINERANVIL_1#(this).getItem(1);
         Map map = EnchantmentManager.#FIELD_ENCHANTMENTMANAGER_3#(itemstack1);
         boolean flag = false;
         int k = b0 + itemstack.getRepairCost() + (itemstack2 == null ? 0 : itemstack2.getRepairCost());
         _exp = 0;
         int l;
         int i1;
         int j1;
         int k1;
         int l1;
         Iterator iterator;
         Enchantment enchantment;
         if(itemstack2 != null)
         {
             flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.#FIELD_ITEMENCHANTEDBOOK_2#(itemstack2).size() > 0;
             if(itemstack1.#FIELD_ITEM_6#() && Item.byId[itemstack1.id].a(itemstack, itemstack2))
             {
                 l = Math.min(itemstack1.#FIELD_ITEMSTACK_5#(), itemstack1.#FIELD_ITEMSTACK_6#() / 4);
                 if(l <= 0)
                 {
                     getInv("#FIELD_CONTAINERANVIL_2#").setItem(0, null);
                     #FIELD_CONTAINERANVIL_5# = 0;
                     return;
                 }
                 for(i1 = 0; l > 0 && i1 < itemstack2.count; ++i1)
                 {
                     j1 = itemstack1.#FIELD_ITEMSTACK_5#() - l;
                     itemstack1.setData(j1);
                     i += Math.max(1, l / 100) + map.size();
                     l = Math.min(itemstack1.#FIELD_ITEMSTACK_5#(), itemstack1.#FIELD_ITEMSTACK_6#() / 4);
                 }
                 _exp = i1;
             }
             else
             {
                 if(!flag && (itemstack1.id != itemstack2.id || !itemstack1.#FIELD_ITEM_6#()))
                 {
                     getInv("#FIELD_CONTAINERANVIL_2#").setItem(0, null);
                     #FIELD_CONTAINERANVIL_5# = 0;
                     return;
                 }
                 if(itemstack1.#FIELD_ITEM_6#() && !flag)
                 {
                     l = itemstack.#FIELD_ITEMSTACK_6#() - itemstack.#FIELD_ITEMSTACK_5#();
                     i1 = itemstack2.#FIELD_ITEMSTACK_6#() - itemstack2.#FIELD_ITEMSTACK_5#();
                     j1 = i1 + itemstack1.#FIELD_ITEMSTACK_6#() * 12 / 100;
                     int i2 = l + j1;
                     k1 = itemstack1.#FIELD_ITEMSTACK_6#() - i2;
                     if(k1 < 0)
                     {
                         k1 = 0;
                     }
                     if(k1 < itemstack1.getData())
                     {
                         itemstack1.setData(k1);
                         i += Math.max(1, j1 / 100);
                     }
                 }
                 Map map1 = EnchantmentManager.#FIELD_ENCHANTMENTMANAGER_3#(itemstack2);
                 iterator = map1.keySet().iterator();
                 while(iterator.hasNext())
                 {
                     j1 = ((Integer)iterator.next()).intValue();
                     enchantment = Enchantment.byId[j1];
                     k1 = map.containsKey(Integer.valueOf(j1)) ? ((Integer)map.get(Integer.valueOf(j1))).intValue() : 0;
                     l1 = ((Integer)map1.get(Integer.valueOf(j1))).intValue();
                     int j2;
                     if(k1 == l1)
                     {
                         ++l1;
                         j2 = l1;
                     }
                     else
                     {
                         j2 = Math.max(l1, k1);
                     }
                     l1 = j2;
                     int k2 = l1 - k1;
                     boolean flag1 = enchantment.canEnchant(itemstack);
                     if(playerFree(_player))
                     {
                         flag1 = true;
                     }
                     Iterator iterator1 = map.keySet().iterator();
                     while(iterator1.hasNext())
                     {
                         int l2 = ((Integer)iterator1.next()).intValue();
                         if(l2 != j1 && !enchantment.#FIELD_ENCHANTMENT_1#(Enchantment.byId[l2]))
                         {
                             flag1 = false;
                             i += k2;
                         }
                     }
                     if(flag1)
                     {
                         if(l1 > enchantment.getMaxLevel())
                         {
                             l1 = enchantment.getMaxLevel();
                         }
                         map.put(Integer.valueOf(j1), Integer.valueOf(l1));
                         int i3 = 0;
                         switch(enchantment.getRandomWeight())
                         {
                             case 1:
                                 i3 = 8;
                                 break;
                             case 2:
                                 i3 = 4;
                             case 3:
                             case 4:
                             case 6:
                             case 7:
                             case 8:
                             case 9:
                             default:
                                 break;
                             case 5:
                                 i3 = 2;
                                 break;
                             case 10:
                                 i3 = 1;
                         }
                         i += i3 * k2;
                     }
                 }
             }
         }
         if(_itemName != null && !_itemName.equalsIgnoreCase(itemstack.#FIELD_ITEMSTACK_7#()) && _itemName.length() > 0)
         {
             j = itemstack.#FIELD_ITEM_6#() ? 7 : itemstack.count * 5;
             i += j;
             if(itemstack.#FIELD_ITEMSTACK_8#())
             {
                 k += j / 2;
             }
             itemstack1.#FIELD_ITEMSTACK_9#(_itemName);
         }
         l = 0;
         for(iterator = map.keySet().iterator(); iterator.hasNext(); k += l + k1 * l1)
         {
             j1 = ((Integer)iterator.next()).intValue();
             enchantment = Enchantment.byId[j1];
             k1 = ((Integer)map.get(Integer.valueOf(j1))).intValue();
             l1 = 0;
             ++l;
             switch(enchantment.getRandomWeight())
             {
                 case 1:
                     l1 = 8;
                     break;
                 case 2:
                     l1 = 4;
                 case 3:
                 case 4:
                 case 6:
                 case 7:
                 case 8:
                 case 9:
                 default:
                     break;
                 case 5:
                     l1 = 2;
                     break;
                 case 10:
                     l1 = 1;
             }
             if(flag)
             {
                 l1 = Math.max(1, l1 / 2);
             }
         }
         if(flag)
         {
             k = Math.max(1, k / 2);
         }
         #FIELD_CONTAINERANVIL_5# = k + i;
         if(i <= 0)
         {
             itemstack1 = null;
         }
         if(j == i && j > 0 && #FIELD_CONTAINERANVIL_5# >= 40)
         {
             #FIELD_CONTAINERANVIL_5# = 39;
         }
         if(#FIELD_CONTAINERANVIL_5# >= 40 && !playerFree(_player))
         {
             itemstack1 = null;
         }
         if(itemstack1 != null)
         {
             i1 = itemstack1.getRepairCost();
             if(itemstack2 != null && i1 < itemstack2.getRepairCost())
             {
                 i1 = itemstack2.getRepairCost();
             }
             if(itemstack1.#FIELD_ITEMSTACK_8#())
             {
                 i1 -= 9;
             }
             if(i1 < 0)
             {
                 i1 = 0;
             }
             i1 += 2;
             itemstack1.setRepairCost(i1);
             EnchantmentManager.#FIELD_ENCHANTMENTMANAGER_4#(map, itemstack1);
         }
         getInv("#FIELD_CONTAINERANVIL_2#").setItem(0, itemstack1);
         #FIELD_CONTAINER_9#();
     }
 }