summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2013-01-01 15:20:26 -0800
committerKHobbits <rob@khobbits.co.uk>2013-01-01 15:20:26 -0800
commit9a91c99391d6e7aeae1b66a1aebac0b7a19b5599 (patch)
treeda033558ee9f7bed4af34d0e995a25eaa8ed42c7
parentc6dd921f0c91006e360067abf6fe349da031eca4 (diff)
parente572e7c94cae5a783ff6f02081839c8fcc72d938 (diff)
downloadEssentials-9a91c99391d6e7aeae1b66a1aebac0b7a19b5599.tar
Essentials-9a91c99391d6e7aeae1b66a1aebac0b7a19b5599.tar.gz
Essentials-9a91c99391d6e7aeae1b66a1aebac0b7a19b5599.tar.lz
Essentials-9a91c99391d6e7aeae1b66a1aebac0b7a19b5599.tar.xz
Essentials-9a91c99391d6e7aeae1b66a1aebac0b7a19b5599.zip
Merge pull request #236 from gravypod/patch-1
Store ingredient map and recipe shape
-rwxr-xr-xEssentials/src/com/earth2me/essentials/commands/Commandrecipe.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
index 4325f13d8..57294e53c 100755
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrecipe.java
@@ -97,11 +97,13 @@ public class Commandrecipe extends EssentialsCommand
final User user = ess.getUser(sender);
user.setRecipeSee(true);
final InventoryView view = user.openWorkbench(null, true);
- for (int j = 0; j < recipe.getShape().length; j++)
+ final String[] recipeShape = recipe.getShape();
+ final Map<Character, ItemStack> ingredientMap = recipe.getIngredientMap();
+ for (int j = 0; j < recipeShape.length; j++)
{
- for (int k = 0; k < recipe.getShape()[j].length(); k++)
+ for (int k = 0; k < recipeShape[j].length(); k++)
{
- ItemStack item = recipe.getIngredientMap().get(recipe.getShape()[j].toCharArray()[k]);
+ final ItemStack item = ingredientMap.get(recipeShape[j].toCharArray()[k]);
if(item == null)
{
continue;
@@ -110,7 +112,6 @@ public class Commandrecipe extends EssentialsCommand
view.getTopInventory().setItem(j * 3 + k + 1, item);
}
}
-
}
else
{
@@ -193,4 +194,4 @@ public class Commandrecipe extends EssentialsCommand
}
return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH);
}
-} \ No newline at end of file
+}