    001    package net.minecraft.item.crafting;
    002
    003    import net.minecraft.inventory.InventoryCrafting;
    004    import net.minecraft.item.Item;
    005    import net.minecraft.item.ItemStack;
    006    import net.minecraft.world.World;
    007
    008    public class RecipesMapCloning implements IRecipe
    009    {
    010        /**
    011         * Used to check if a recipe matches current crafting inventory
    012         */
    013        public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World)
    014        {
    015            int var3 = 0;
    016            ItemStack var4 = null;
    017
    018            for (int var5 = 0; var5 < par1InventoryCrafting.getSizeInventory(); ++var5)
    019            {
    020                ItemStack var6 = par1InventoryCrafting.getStackInSlot(var5);
    021
    022                if (var6 != null)
    023                {
    024                    if (var6.itemID == Item.map.shiftedIndex)
    025                    {
    026                        if (var4 != null)
    027                        {
    028                            return false;
    029                        }
    030
    031                        var4 = var6;
    032                    }
    033                    else
    034                    {
    035                        if (var6.itemID != Item.emptyMap.shiftedIndex)
    036                        {
    037                            return false;
    038                        }
    039
    040                        ++var3;
    041                    }
    042                }
    043            }
    044
    045            return var4 != null && var3 > 0;
    046        }
    047
    048        /**
    049         * Returns an Item that is the result of this recipe
    050         */
    051        public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting)
    052        {
    053            int var2 = 0;
    054            ItemStack var3 = null;
    055
    056            for (int var4 = 0; var4 < par1InventoryCrafting.getSizeInventory(); ++var4)
    057            {
    058                ItemStack var5 = par1InventoryCrafting.getStackInSlot(var4);
    059
    060                if (var5 != null)
    061                {
    062                    if (var5.itemID == Item.map.shiftedIndex)
    063                    {
    064                        if (var3 != null)
    065                        {
    066                            return null;
    067                        }
    068
    069                        var3 = var5;
    070                    }
    071                    else
    072                    {
    073                        if (var5.itemID != Item.emptyMap.shiftedIndex)
    074                        {
    075                            return null;
    076                        }
    077
    078                        ++var2;
    079                    }
    080                }
    081            }
    082
    083            if (var3 != null && var2 >= 1)
    084            {
    085                ItemStack var6 = new ItemStack(Item.map, var2 + 1, var3.getItemDamage());
    086
    087                if (var3.hasDisplayName())
    088                {
    089                    var6.setItemName(var3.getDisplayName());
    090                }
    091
    092                return var6;
    093            }
    094            else
    095            {
    096                return null;
    097            }
    098        }
    099
    100        /**
    101         * Returns the size of the recipe area
    102         */
    103        public int getRecipeSize()
    104        {
    105            return 9;
    106        }
    107
    108        public ItemStack getRecipeOutput()
    109        {
    110            return null;
    111        }
    112    }