mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-08-13 14:37:34 +00:00
Merge pull request #236 from gravypod/patch-1
Store ingredient map and recipe shape
This commit is contained in:
commit
9a91c99391
|
@ -97,11 +97,13 @@ public class Commandrecipe extends EssentialsCommand
|
||||||
final User user = ess.getUser(sender);
|
final User user = ess.getUser(sender);
|
||||||
user.setRecipeSee(true);
|
user.setRecipeSee(true);
|
||||||
final InventoryView view = user.openWorkbench(null, 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)
|
if(item == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -110,7 +112,6 @@ public class Commandrecipe extends EssentialsCommand
|
||||||
view.getTopInventory().setItem(j * 3 + k + 1, item);
|
view.getTopInventory().setItem(j * 3 + k + 1, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -193,4 +194,4 @@ public class Commandrecipe extends EssentialsCommand
|
||||||
}
|
}
|
||||||
return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH);
|
return type.toString().replace("_", " ").toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue