[Fix] Hammer in first slot gets consumed by Recipe (BetterEnd/issues#17)
This commit is contained in:
parent
4c54e6de31
commit
600aa50212
2 changed files with 42 additions and 52 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue