CraftingHelper - Properly name the variables
This commit is contained in:
parent
1e00cf012b
commit
7073a10fc5
1 changed files with 29 additions and 27 deletions
|
@ -14,59 +14,61 @@ public class CraftingHelper {
|
|||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public static IRecipe findMatchingRecipe(InventoryCrafting par1InventoryCrafting, World par2World)
|
||||
{
|
||||
int var3 = 0;
|
||||
ItemStack var4 = null;
|
||||
ItemStack var5 = null;
|
||||
int var6;
|
||||
// Begin repair recipe handler
|
||||
int itemNum = 0;
|
||||
ItemStack item1 = null;
|
||||
ItemStack item2 = null;
|
||||
int slot;
|
||||
|
||||
for (var6 = 0; var6 < par1InventoryCrafting.getSizeInventory(); ++var6)
|
||||
for (slot = 0; slot < par1InventoryCrafting.getSizeInventory(); ++slot)
|
||||
{
|
||||
ItemStack var7 = par1InventoryCrafting.getStackInSlot(var6);
|
||||
ItemStack itemInSlot = par1InventoryCrafting.getStackInSlot(slot);
|
||||
|
||||
if (var7 != null)
|
||||
if (itemInSlot != null)
|
||||
{
|
||||
if (var3 == 0)
|
||||
if (itemNum == 0)
|
||||
{
|
||||
var4 = var7;
|
||||
item1 = itemInSlot;
|
||||
}
|
||||
|
||||
if (var3 == 1)
|
||||
if (itemNum == 1)
|
||||
{
|
||||
var5 = var7;
|
||||
item2 = itemInSlot;
|
||||
}
|
||||
|
||||
++var3;
|
||||
++itemNum;
|
||||
}
|
||||
}
|
||||
|
||||
if (var3 == 2 && var4.itemID == var5.itemID && var4.stackSize == 1 && var5.stackSize == 1 && Item.itemsList[var4.itemID].isRepairable())
|
||||
if (itemNum == 2 && item1.itemID == item2.itemID && item1.stackSize == 1 && item2.stackSize == 1 && Item.itemsList[item1.itemID].isRepairable())
|
||||
{
|
||||
Item var11 = Item.itemsList[var4.itemID];
|
||||
int var13 = var11.getMaxDamage() - var4.getItemDamageForDisplay();
|
||||
int var8 = var11.getMaxDamage() - var5.getItemDamageForDisplay();
|
||||
int var9 = var13 + var8 + var11.getMaxDamage() * 5 / 100;
|
||||
int var10 = var11.getMaxDamage() - var9;
|
||||
Item itemBase = Item.itemsList[item1.itemID];
|
||||
int item1Durability = itemBase.getMaxDamage() - item1.getItemDamageForDisplay();
|
||||
int item2Durability = itemBase.getMaxDamage() - item2.getItemDamageForDisplay();
|
||||
int repairAmt = item1Durability + item2Durability + itemBase.getMaxDamage() * 5 / 100;
|
||||
int newDamage = itemBase.getMaxDamage() - repairAmt;
|
||||
|
||||
if (var10 < 0)
|
||||
if (newDamage < 0)
|
||||
{
|
||||
var10 = 0;
|
||||
newDamage = 0;
|
||||
}
|
||||
|
||||
ArrayList ingredients = new ArrayList<ItemStack>(2);
|
||||
ingredients.add(var4);
|
||||
ingredients.add(var5);
|
||||
return new ShapelessRecipes(new ItemStack(var4.itemID, 1, var10),ingredients);
|
||||
ingredients.add(item1);
|
||||
ingredients.add(item2);
|
||||
return new ShapelessRecipes(new ItemStack(item1.itemID, 1, newDamage),ingredients);
|
||||
}
|
||||
// End repair recipe handler
|
||||
else
|
||||
{
|
||||
List recipes = CraftingManager.getInstance().getRecipeList();
|
||||
for (var6 = 0; var6 < recipes.size(); ++var6)
|
||||
for (int index = 0; index < recipes.size(); ++index)
|
||||
{
|
||||
IRecipe var12 = (IRecipe) recipes.get(var6);
|
||||
IRecipe currentRecipe = (IRecipe) recipes.get(index);
|
||||
|
||||
if (var12.matches(par1InventoryCrafting, par2World))
|
||||
if (currentRecipe.matches(par1InventoryCrafting, par2World))
|
||||
{
|
||||
return var12;
|
||||
return currentRecipe;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue