1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-27 08:24:44 +02:00

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) public void shapedRecipe(CommandSender sender, ShapedRecipe recipe)
{ {
Map<Character, ItemStack> recipeMap = recipe.getIngredientMap(); Map<Character, ItemStack> recipeMap = recipe.getIngredientMap();
if (sender instanceof Player) if (sender instanceof Player)
{ {
User user = ess.getUser(sender); User user = ess.getUser(sender);
user.setRecipeSee(true); user.setRecipeSee(true);
InventoryView view = user.openWorkbench(null, true); InventoryView view = user.openWorkbench(null, true);
String shapeMap = recipe.getShape().length == 2 ? " abecdfghi" : " abcdefghi";
for (Entry<Character, ItemStack> e : ((ShapedRecipe)recipe).getIngredientMap().entrySet()) 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());
} }
} }