[Fix] Hammer in first slot gets consumed by Recipe (BetterEnd/issues#17)

This commit is contained in:
Frank 2022-06-30 11:23:24 +02:00
parent 4c54e6de31
commit 600aa50212
2 changed files with 42 additions and 52 deletions

View file

@ -115,6 +115,18 @@ public class AnvilRecipe implements Recipe<Container>, UnknownReceipBookCategory
return this.output.copy();
}
public static int getHammerSlot(Container c) {
ItemStack h = c.getItem(0);
if (!h.isEmpty() && h.is(CommonItemTags.HAMMERS)) return 0;
//this is the default slot
return 1;
}
public static int getIngredientSlot(Container c) {
return Math.abs(getHammerSlot(c) - 1);
}
public ItemStack getHammer(Container c) {
ItemStack h = c.getItem(1);
if (!h.isEmpty() && h.is(CommonItemTags.HAMMERS)) return h;