Fix recipe layout for small shapes

This commit is contained in:
KHobbits 2012-12-21 03:35:48 +00:00
parent a8a8b52977
commit 13a847e0ab

View File

@ -84,14 +84,17 @@ public class Commandrecipe extends EssentialsCommand
public void shapedRecipe(CommandSender sender, ShapedRecipe recipe)
{
Map<Character, ItemStack> recipeMap = recipe.getIngredientMap();
if (sender instanceof Player)
{
User user = ess.getUser(sender);
user.setRecipeSee(true);
InventoryView view = user.openWorkbench(null, true);
String shapeMap = recipe.getShape().length == 2 ? " abecdfghi" : " abcdefghi";
for (Entry<Character, ItemStack> e : ((ShapedRecipe)recipe).getIngredientMap().entrySet())
{
view.setItem(" abcdefghi".indexOf(e.getKey()), e.getValue());
e.getValue().setAmount(0);
view.setItem(shapeMap.indexOf(e.getKey()), e.getValue());
}
}