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