Anvil crafting fixes
This commit is contained in:
parent
c5182a4418
commit
7e367a1971
9 changed files with 76 additions and 83 deletions
|
@ -5,27 +5,29 @@ import java.util.List;
|
|||
import ru.betterend.recipe.builders.AnvilRecipe;
|
||||
|
||||
public interface AnvilScreenHandlerExtended {
|
||||
public void be_updateCurrentRecipe(AnvilRecipe recipe);
|
||||
public AnvilRecipe be_getCurrentRecipe();
|
||||
public List<AnvilRecipe> be_getRecipes();
|
||||
void be_updateCurrentRecipe(AnvilRecipe recipe);
|
||||
AnvilRecipe be_getCurrentRecipe();
|
||||
List<AnvilRecipe> be_getRecipes();
|
||||
|
||||
default void be_nextRecipe() {
|
||||
List<AnvilRecipe> recipes = this.be_getRecipes();
|
||||
AnvilRecipe current = this.be_getCurrentRecipe();
|
||||
List<AnvilRecipe> recipes = be_getRecipes();
|
||||
if (recipes.size() < 2) return;
|
||||
AnvilRecipe current = be_getCurrentRecipe();
|
||||
int i = recipes.indexOf(current) + 1;
|
||||
if (i >= recipes.size()) {
|
||||
i = 0;
|
||||
}
|
||||
this.be_updateCurrentRecipe(recipes.get(i));
|
||||
be_updateCurrentRecipe(recipes.get(i));
|
||||
}
|
||||
|
||||
default void be_previousRecipe() {
|
||||
List<AnvilRecipe> recipes = this.be_getRecipes();
|
||||
AnvilRecipe current = this.be_getCurrentRecipe();
|
||||
List<AnvilRecipe> recipes = be_getRecipes();
|
||||
if (recipes.size() < 2) return;
|
||||
AnvilRecipe current = be_getCurrentRecipe();
|
||||
int i = recipes.indexOf(current) - 1;
|
||||
if (i <= 0) {
|
||||
i = recipes.size() - 1;
|
||||
}
|
||||
this.be_updateCurrentRecipe(recipes.get(i));
|
||||
be_updateCurrentRecipe(recipes.get(i));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue