    001    package net.minecraft.src;
    002
    003    public class RecipesMapExtending extends ShapedRecipes
    004    {
    005        public RecipesMapExtending()
    006        {
    007            super(3, 3, new ItemStack[] {new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.map, 0, -1), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper), new ItemStack(Item.paper)}, new ItemStack(Item.emptyMap, 0, 0));
    008        }
    009
    010        /**
    011         * Used to check if a recipe matches current crafting inventory
    012         */
    013        public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World)
    014        {
    015            if (!super.matches(par1InventoryCrafting, par2World))
    016            {
    017                return false;
    018            }
    019            else
    020            {
    021                ItemStack var3 = null;
    022
    023                for (int var4 = 0; var4 < par1InventoryCrafting.getSizeInventory() && var3 == null; ++var4)
    024                {
    025                    ItemStack var5 = par1InventoryCrafting.getStackInSlot(var4);
    026
    027                    if (var5 != null && var5.itemID == Item.map.shiftedIndex)
    028                    {
    029                        var3 = var5;
    030                    }
    031                }
    032
    033                if (var3 == null)
    034                {
    035                    return false;
    036                }
    037                else
    038                {
    039                    MapData var6 = Item.map.getMapData(var3, par2World);
    040                    return var6 == null ? false : var6.scale < 4;
    041                }
    042            }
    043        }
    044
    045        /**
    046         * Returns an Item that is the result of this recipe
    047         */
    048        public ItemStack getCraftingResult(InventoryCrafting par1InventoryCrafting)
    049        {
    050            ItemStack var2 = null;
    051
    052            for (int var3 = 0; var3 < par1InventoryCrafting.getSizeInventory() && var2 == null; ++var3)
    053            {
    054                ItemStack var4 = par1InventoryCrafting.getStackInSlot(var3);
    055
    056                if (var4 != null && var4.itemID == Item.map.shiftedIndex)
    057                {
    058                    var2 = var4;
    059                }
    060            }
    061
    062            var2 = var2.copy();
    063            var2.stackSize = 1;
    064
    065            if (var2.getTagCompound() == null)
    066            {
    067                var2.setTagCompound(new NBTTagCompound());
    068            }
    069
    070            var2.getTagCompound().setBoolean("map_is_scaling", true);
    071            return var2;
    072        }
    073    }